Answer the question
In order to leave comments, you need to log in
What to do if the page takes a long time to load selenium python?
Using the Selenium library, I have to go to the same site many times and wait for the page to load for 5 seconds. How is it possible to save this page so that it does not load for a long time?
Answer the question
In order to leave comments, you need to log in
No way, if the page could be saved, then you would probably use requests, not selenium.
You can do something like this:
from selenium import webdriver
driver = webdriver.Chrome('D:\\chromedriver.exe')
# грузим страницу с сайта
driver.get('https://test.com')
# сохраняем страницу в файл
with open('D:\\Temp\\SaveHtm.html', 'bw') as out_file:
out_file.write(driver.page_source.encode('utf-8', errors = 'strict'))
out_file.close()
# грузим страницу из файла
driver.get('file:///D:/Temp/SaveHtm.html')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question