execute-script

How can I use selenium to record mathjax loading time

送分小仙女□ 提交于 2019-12-11 12:39:43
问题 I am trying to use selenium get asynchronous elements(MathJax equation) loading time. I try to write a python-selenium script to record the loading time of my website, but my website contains a lot of equation which converted by Mathjax asynchronous, so that I cannot record it correctly. I try to use "performance.timing" to record the loading time first, but it only can provide me 'load time'. from selenium import webdriver source = "url" driver = webdriver.Chrome() driver.get(source)

Wait until page is loaded with Selenium WebDriver for Python

折月煮酒 提交于 2019-11-26 03:14:42
问题 I want to scrape all the data of a page implemented by a infinite scroll. The following python code works. for i in range(100): driver.execute_script(\"window.scrollTo(0, document.body.scrollHeight);\") time.sleep(5) This means every time I scroll down to the bottom, I need to wait 5 seconds, which is generally enough for the page to finish loading the newly generated contents. But, this may not be time efficient. The page may finish loading the new contents within 5 seconds. How can I detect