1

I tried execute_script from selenium to return Document.readyState but I'm getting a none type object in return.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
url='https://example.com'
options=Options()
options.set_headless(headless=True)
driver = webdriver.Chrome(options=options)
driver.get(url)
state=driver.execute_script("return Document.readyState")
print(state)
if state=='complete':
    html = driver.page_source

type(state) Out[234]: NoneType

Viren
  • 29
  • 1
  • 2
  • When starting chrome from the command line, you can specify a virtual time budget that executed JavaScript directly. Since I never used selenium, I don't know how that feature is named inside the code. – Ferrybig Jun 27 '19 at 06:36

0 Answers0