1

Is there a way to execute console commands in browser with selenium? (The browser type is of no importance.)

Here is an example:

console in firefox

1 Answer 1

3

Executing commands in the Chrome console for the most part is simply executing javascript code.

Here is a sample:

from selenium import webdriver

path = 'Path to ChromeDriver executable'
driver = webdriver.Chrome(path)
#navigate to the url
driver.get("https://google.com")
#execute console command
driver.execute_script("date1 = '13-11-2015T17:25'; date2 = '25-11-2015T11:01';")

Here is the result: Result

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.