Python selenium
初始化webdriver
opts = webdriver.chrome.options.Options()
# 无头模式
opts.add_argument("--headless")
opts.add_argument("--disable-gpu")
# 驱动地址
driver_path = os.path.join(
os.path.dirname(__file__), "./driver/chromedriver.exe"
)
# 浏览器对象
browser = webdriver.Chrome(
service=webdriver.chrome.service.Service(driver_path), options=opts
)
# 隐示等待
browser.implicitly_wait(9)