How to handle browser alerts by Robot Framework?

2,045 views
Skip to first unread message

Paweł Marek

unread,
Jan 26, 2012, 8:27:25 AM1/26/12
to robotframework-users
Hi, I use robot framework (with Ride and mostly standards libraries)
since couple of weeks and currently I have a problem with browsers
alerts. My problem is how to handle alert generated by browser? The
alert consists of two fields; user name and password and two buttons
Ok and Cancel. I found some information at internet that I should use
here AutoIt Library, and method ControlSetText, but that solution
doesn't work for me.

Maybe anyone had a similar problem and can give me some tips here?

Thanks

Pawel

http://screencast.com/t/CiezZbKheiG

Taisto Tammi

unread,
Jan 26, 2012, 1:43:28 PM1/26/12
to robotframe...@googlegroups.com
Ugh

Based on the picture it seems that we are talking basic authentication
[1]. Afaik, the dialog box is generated by tthe operating system and not
by the browser. But anyway it causes a problem to the selenium library
(or any library/interface that interacts with browser) because the
dialog box can not accessed by the browser controls.


The two most common ways to work around the problem are:
1) Disable the basic authentication. This is the easiest way to deal
with it, but it can be used if you do not need to test the basic
authentication.

2) The second option is to provide the username and password in the URL
[2]. For this purposes one should create some sort of testing password,
because the username and password are visible to all that can access the
test.

[1] http://en.wikipedia.org/wiki/Basic_access_authentication
[2]
http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ#SeleniumCoreFAQ-HowdoIuseSeleniumtologintositesthatrequireHTTPbasicauthentication%28wherethebrowsermakesamodaldialogaskingforcredentials%29%3F

-Tatu

Paweł Marek

unread,
Jan 31, 2012, 4:12:41 AM1/31/12
to robotframework-users
Thanks for your replay Taisto. I have tried with first point, and it
works as should :)

Pawel

On Jan 26, 7:43 pm, Taisto Tammi <god...@gmail.com> wrote:
> Ugh
>
> Based on the picture it seems that we are talking basic authentication
> [1]. Afaik, the dialog box is generated by tthe operating system and not
> by the browser. But anyway it causes a problem to the selenium library
> (or any library/interface that interacts with browser) because the
> dialog box can not accessed by the browser controls.
>
> The two most common ways to work around the problem are:
> 1) Disable the basic authentication. This is the easiest way to deal
> with it, but it can be used if you do not need to test the basic
> authentication.
>
> 2) The second option is to provide the username and password in the URL
> [2]. For this purposes one should create some sort of testing password,
> because the username and password are visible to all that can access the
> test.
>
> [1]http://en.wikipedia.org/wiki/Basic_access_authentication
> [2]http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ#SeleniumCoreFAQ-...
Reply all
Reply to author
Forward
0 new messages