2

I am able to run the following script in Google Chrome console. How can I do this using Selenium Python in Firefox?

date1 = "13-11-2015T17:25"
date2 = "25-11-2015T11:01"
window.PF.start_diff(date1, date2)

I tried with driver.executeScript(), but I do not think I can achieve with this. This is what I am trying when I am in the Firefox and Google Chrome console. First I log in to the app and execute the script and this is what I get:

enter image description here

So it seems like it is working. Note that the pop up appears after executing the command.

I have tried using both of the following:

driver.execute_script("window.PF.start_diff(date1, date2)")
driver.execute_script(window.PF.start_diff(date1, date2)) 

Also tried this: driver.execute_async_script

1 Answer 1

3

I guess you are not defining date1 and date2, try the following:

driver.execute_script("date1 = '13-11-2015T17:25'; date2 = '25-11-2015T11:01'; return window.PF.start_diff(date1, date2);")
Sign up to request clarification or add additional context in comments.

1 Comment

thank you so much. I was defining it outside the script. It works now

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.