I'm attempting to get the extract the value of the variable remainingTimeString
on this website in python using Selenium webdriver. I'm trying to use the driver.execute_script()
function. Here is my code:
import selenium.webdriver options = selenium.webdriver.FirefoxOptions() options.add_argument("--headless") driver = selenium.webdriver.Firefox(options=options) driver.get('https://shopgoodwill.com/item/151632327') print(driver.execute_script("return remainingTimeString"))
However, when I run it, I get:
selenium.common.exceptions.JavascriptException: Message: ReferenceError: remainingTimeString is not defined
What should I do? the variable is clearly in a script when I check the HTML source. Thanks!