ps:不知道为什么python的安装目录在我的电脑上不显示?
所以才无法证实
如果楼上的不行再试试我的
if __name__ == '__main__':
# 输入 Driver 的 绝对路径
driver_path = 'C:\edgedriver_win64\msedgedriver.exe'
# 创建driver对象
driver = webdriver.Chrome(driver_path)
# 指定访问网址,如百度
url = 'https://www.baidu.com/'
# 访问网址
driver.get(url)
应该要指定绝对路径才行
这个程序需要chrome driver.exe
import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from pyquery import PyQuery as pq
url="https://seller.shopee.ph/account/signin?next=%2F"
headers = {"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"}
def initSpider():
global driver,wait
driverOptions = webdriver.ChromeOptions()# 进行Chrome配置
driverOptions.add_experimental_option("useAutomationExtension", False) # 关闭插件
driverOptions.add_experimental_option('excludeSwitches', ['enable-automation', 'enable-logging'])
driver = webdriver.Chrome(options=driverOptions, executable_path='C:/chromedriver.exe')
wait = WebDriverWait(driver, 10)
print("正在搜索", "……")
driver.get(url)
time.sleep(10)
initSpider()
你这样写 path = r"xxx"