Sunday, June 19, 2011

Testing JS popup box using selenium webdriver

To simulate the user clicking the ok or cancel button for a javascript pop up box simply use the following selenium web driver methods into your steps defintion:

<pre>
page.driver.browser.switch_to.alert.accept #to click ok
page.driver.browser.switch_to.alert.dismiss
</pre>

No comments:

Post a Comment