Javascript alerts in Python + Selenium + PhantomJS script Javascript alerts in Python + Selenium + PhantomJS script selenium selenium

Javascript alerts in Python + Selenium + PhantomJS script


As PhantomJs has no support for Alert boxes .you need to use executor for this.

driver.execute_script("window.confirm = function(msg) { return true; }");


In java, driver.switchTo().alert().accept(); will do the job.

I am not sure, why you are using "print al.accept()", probably are you trying to print text? then alert.getText() will do in java, sorry if i am wrong, because i am sure in python.

Thank You,Muralihttp://seleniumtrainer.com/