Issue with clicking on a button which opens a on click alert - works on Firefox but not on phantom.js

72 views
Skip to first unread message

Ankita@Adslot

unread,
May 23, 2013, 1:46:33 AM5/23/13
to watir-...@googlegroups.com
Hi

I have following code
<div>
  <a class="btn btn-inverse" onclick="return confirm(&quot;Are you sure?&quot;);" href="/siteadmin/change-user/6">Login</a>
</div>


Now when you click on this login link, it opens a alert JS message having two buttons OK and Cancel.. Clicking OK will log you in.

I added the code
browser.element(:xpath,"//div/a[contains(.,'Login')]).when_present.click
$b.alert.ok

This code does works fine on firefox, but if I want to use it with phantom.js, seems like it does not click the login button.

Any help would be highly appreciated.

Dan

unread,
May 23, 2013, 9:10:15 AM5/23/13
to watir-...@googlegroups.com
Might want to read up on how ghostdriver handles alerts?  There's a lot of discussion here:

Reply all
Reply to author
Forward
0 new messages