How to click on this confirm?

142 views
Skip to first unread message

Mayank Jain

unread,
May 24, 2013, 1:52:39 AM5/24/13
to clj-we...@googlegroups.com
Hi,
I am getting this confirm modal when I submit a form.
I tried:

(taxi/accept)
-> Nothing happens, hangs till I either I press cancel or okay

(taxi/send-keys "body" (clj-webdriver.core/key-code :enter))
-> Modal dialog present
Build info: version: '2.31.0', revision: '1bd294d185a80fa4206dfeab80ba773c04ac33c0', time: '2013-02-27 13:51:26'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.3', java.version: '1.6.0_45'
Session ID: 55396a53-2db5-0f48-9110-62b54070a4b6
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=22.0, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
  [Thrown class org.openqa.selenium.UnhandledAlertException]


It's not a normal popup and I don't know what its called.
Any ideas on what exactly it is?





--
Regards,
Mayank.
Screen Shot 2013-05-24 at 11.08.28 AM.png

Mayank Jain

unread,
May 24, 2013, 1:56:11 AM5/24/13
to clj-we...@googlegroups.com
PS - I am using [clj-webdriver "0.6.0"]
--
Regards,
Mayank.

Daniel Gregoire

unread,
May 24, 2013, 10:50:43 AM5/24/13
to clj-we...@googlegroups.com
To be honest, I don't know what Selenium's support for this is. I'd take a look at the parts of the Java API that taxi/accept uses and see if there are any other "nearby" Java methods that could work for you. If not, you probably want to ask on the SW mailing list.


--
You received this message because you are subscribed to the Google Groups "clj-webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-webdrive...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Fernando Dobladez

unread,
May 24, 2013, 11:50:56 AM5/24/13
to clj-we...@googlegroups.com
Here's an idea on webdriver: http://stackoverflow.com/questions/12082052/how-can-i-get-webdriver-to-dismiss-a-firefox-security-alert

If that doesn't work, I would try using a custom user profile on Firefox, with security alerts disabled. Some pointers here:




--

Daniel Gregoire

unread,
May 24, 2013, 12:18:02 PM5/24/13
to clj-we...@googlegroups.com
Fernando - thanks for providing those links.

Mayank - That SO post describes using the same Java method that taxi/accept should be calling. If you find using the method directly (via Java interop, for example) works but taxi/accept does not, please file a bug. Otherwise, it might be an issue of versions/support or a genuine SW bug.

Please let us know what you find, in case this is a clj-webdriver bug. Thanks.

-Daniel

Mayank Jain

unread,
May 24, 2013, 1:48:21 PM5/24/13
to clj-we...@googlegroups.com
I am not clear how to use that via interop?
@Daniel any hints? ( I am not very familiar with interop in clojure).
Regards,
Mayank.

Daniel Gregoire

unread,
May 24, 2013, 2:05:50 PM5/24/13
to clj-we...@googlegroups.com
Now's as good a time as any to learn :)


If you find the -> threading macro less readable than plain ol' Clojure, the accept function body equates to: (.accept (.alert (.switchTo (:webdriver driver)))).

Mayank Jain

unread,
May 25, 2013, 6:19:18 PM5/25/13
to clj-we...@googlegroups.com
I tried the following :
> (-> taxi/*driver*
              :webdriver
              .switchTo
              .alert
              .accept)
Didn't work.

To be sure if I am able to run the interop right I tried the following
> (.quit (:webdriver taxi/*driver*))
It did quit.

Tried the plain vanilla too. didn't work.
>  (.accept (.alert (.switchTo (:webdriver taxi/*driver*))))


Looks like its an issue at webdriver level :-/

Daniel Gregoire

unread,
May 25, 2013, 9:27:34 PM5/25/13
to clj-we...@googlegroups.com
Understood. Thanks for reporting back, Mayank.

I don't know the underlying mechanics around SW's support for browser dialogs. I'd be curious if you're having issues with all kinds of dialog (e.g., ones created with JavaScript's 'window.alert()' function), or just this particular type of dialog. Are you?

Mayank Jain

unread,
May 27, 2013, 4:44:51 AM5/27/13
to clj-we...@googlegroups.com
I tried the following code:
var r=confirm("Press a button");
if (r==true)
{x="You pressed OK!";}
else
{x="You pressed Cancel!";}

console.log(x);
And ran taxi api's accept, dismiss & alert-text. all worked as expected.
So I am guessing its an issue specific to this security dialogue box.

Daniel Gregoire

unread,
May 27, 2013, 10:23:23 AM5/27/13
to clj-we...@googlegroups.com

Thanks for tracking all of that, Mayank. It would be a good idea to see if there is already an open SW ticket that covers this bug, and if not, you should open a new issue for it with the SW project, so they're at least aware of the shortcoming.

- Daniel

Reply all
Reply to author
Forward
0 new messages