Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selenium打开网页加载慢 #2

Open
ty3251778 opened this issue May 30, 2021 · 0 comments
Open

selenium打开网页加载慢 #2

ty3251778 opened this issue May 30, 2021 · 0 comments

Comments

@ty3251778
Copy link

1.设置加载时间
driver.set_page_load_timeout(时间,秒)

driver = webdriver.Chrome(options=options)
driver.set_page_load_timeout(10)
driver.get(url)

2.减少加载内容
chrome_options.page_load_strategy = 'none'

3.停止页面加载
try:
driver.get(url)
except:
driver.execute_script('window.stop()')
或者
try:
driver.get(url)
except:
driver.execute_script('window.stop() ? window.stop() : document.execCommand("stop");')

4.显隐式等待,因为我没用到,不会写了.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant