Skip to content
Advertisement

Can I console.log into Selenium driver?

I’d like to know if it’s possible to write into the console of an opened page in selenium webdriver, for example, like this:

driver = webdriver.Chrome()
driver.get(url)
driver.console.log("something")

Advertisement

Answer

   driver.execute_script("console.log('something')")

Use driver.execute_script to execute javascript on browser console

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement