cva6
cva6

Reputation: 385

Selenium Python execute script in the Firefox console

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

Upvotes: 2

Views: 5419

Answers (1)

Mesut GUNES
Mesut GUNES

Reputation: 7401

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);")

Upvotes: 3

Related Questions