selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:“xpath”,“selector”:".//div[contains(@class,“c-goods-item__market-price”)]/text()"}(Session info: chrome=99.0.4844.51)
抓取某购物网站页面内容,以“小皮鞋”字段为例,代码如图
from selenium import webdriver
import time,random
from pymongo import MongoClient
from selenium.common.exceptions import NoSuchElementException
classWp():def__init__(self):
options = webdriver.ChromeOptions()
options.add_argument('--disable-blink-features=AutomationControlled')
self.browser = webdriver.Chrome(chrome_options=options)defbase(self):# 访问网站
self.browser.get('https://www.vip.com/')# 获取输入框input= self.browser.find_element_by_css_selector
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate elemen
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:“xpath”,“selector”:“.//div[contains(@class,“c-goods-item__market-price”)]/text()”}(Session info: chrome=99.0.4844.51)抓取唯品会页面内容,以“小皮鞋”字段为例,代码如图