Basic authentication on Linux with FireWatir

26 views
Skip to first unread message

Aedorn Varanis

unread,
Oct 27, 2009, 1:16:15 PM10/27/09
to watir-...@googlegroups.com
I took a look around but it doesn't like there's any answer to this. I've recently been tasked to automate testing of a product, and the only thing I can't seem to solve is basic authentication, which is rather funny to me, but not so much to those who are waiting on this being done.

So how can one go about doing basic authentication with FireWatir/Firefox on Linux currently?

aidy lewis

unread,
Oct 27, 2009, 3:09:35 PM10/27/09
to watir-...@googlegroups.com
Can you not set your trusted uri's in about:config

network.automatic-ntlm-auth.trusted-uris ?

Aidy



2009/10/27 Aedorn Varanis <aed...@gmail.com>:

Aedorn Varanis

unread,
Oct 27, 2009, 3:53:51 PM10/27/09
to watir-...@googlegroups.com
This doesn't really solve the problem.

Chris

unread,
Oct 27, 2009, 7:52:59 PM10/27/09
to Watir General

I looked into this a long time ago, and there is no way to persist a
Basic Auth session in a browser. You have to have credentials for
every page request and every frame within every page. I was hacking
around deep in the guts of Watir trying to make this work and failed.

Nor do I know of any other tool that makes this possible. There might
be something fancy you could do in multiple libraries used by Watir,
but I did not have that kind of mandate.

I suggest a well-designed set of manual tours.

-Chris

On Oct 27, 1:53 pm, Aedorn Varanis <aed...@gmail.com> wrote:
> This doesn't really solve the problem.
>

aidy lewis

unread,
Oct 27, 2009, 8:28:06 PM10/27/09
to watir-...@googlegroups.com
The Firefox browser is completly scriptable. I would suggest looking
at the Mozilla js classes.

2009/10/27 Chris <christoph...@gmail.com>:
>
>
> I looked into this a long time ago, and there is no way to persist a
> Basic Auth session in a browser.  You have to have credentials for
> every page request and every frame within every page.   I was hacking
> around deep in the guts of Watir trying to make this work and failed.
>
> Nor do I know of any other tool that makes this possible.  There might
> be something fancy you could do in multiple libraries used by Watir,
> buiret I did not have that kind of mandate.

Ethan

unread,
Oct 27, 2009, 8:33:10 PM10/27/09
to watir-...@googlegroups.com
Yeah, you should be able to get a handle to the window where you enter username/password, get the text fields on that window, set them, click the 'ok' button. That'd all be in javascript over the jssh socket. 

Raveendran P

unread,
Oct 28, 2009, 12:58:21 AM10/28/09
to watir-...@googlegroups.com
Hi Aedorn,
 
           I got some idea's from Selenium.I implemented it in my Watir scripts. Have you tried this way?  -- > http://bit.ly/21zDrH

            Awaiting your reply

Thanks
--
Regards,
P.Raveendran
http://raveendran.wordpress.com

Angrez Singh

unread,
Oct 28, 2009, 3:20:11 AM10/28/09
to watir-...@googlegroups.com
I have added the basic authentication mechanism to Firewatir. Its not yet released. Me & Bret need to finalize on the syntax, method name etc so that its easier to use both with Watir/Firewatir.

- Angrez

Aedorn Varanis

unread,
Oct 28, 2009, 5:05:08 AM10/28/09
to watir-...@googlegroups.com
When you do it this way we get a couple of popups. The first being a "this could be a trick as the site doesn't require" and the second a confirmation. Both which we can't close automatically, it seems. I'll look at the scripting method for Firefox.

Chris

unread,
Oct 28, 2009, 9:42:01 AM10/28/09
to Watir General


On Oct 28, 1:20 am, Angrez Singh <ang...@gmail.com> wrote:
> I have added the basic authentication mechanism to Firewatir. Its not yet
> released. Me & Bret need to finalize on the syntax, method name etc so that
> its easier to use both with Watir/Firewatir.

That's cool. I could have used that some time ago. :-)

aidy lewis

unread,
Oct 28, 2009, 10:01:51 AM10/28/09
to watir-...@googlegroups.com
Angrez,

Is that code on github though?

Aidy

2009/10/28 Angrez Singh <ang...@gmail.com>:

Angrez Singh

unread,
Oct 28, 2009, 10:36:55 AM10/28/09
to watir-...@googlegroups.com
Its in my fork on github. You can have a look.
- Angrez

aidy lewis

unread,
Oct 28, 2009, 1:12:50 PM10/28/09
to watir-...@googlegroups.com
What file and methods should I be looking at?

Thanks

Angrez Singh

unread,
Oct 28, 2009, 1:32:31 PM10/28/09
to watir-...@googlegroups.com
firefox.rb file contains code for basic authentication.

aidy lewis

unread,
Oct 28, 2009, 2:20:42 PM10/28/09
to watir-...@googlegroups.com
Sorry Angrez

But where is the getWindows method coming from?

Angrez Singh

unread,
Oct 28, 2009, 3:32:45 PM10/28/09
to watir-...@googlegroups.com
getWindows() is method exposed by jssh with gives you all the Firefox windows which are currently opened. Is this what you are asking? Or am I missing something?

Chris

unread,
Oct 29, 2009, 9:58:43 AM10/29/09
to Watir General

FWIW: http://chrismcmahonsblog.blogspot.com/2006/05/internet-explorer-basic-authorization.html

On Oct 28, 1:20 am, Angrez Singh <ang...@gmail.com> wrote:
> I have added the basic authentication mechanism to Firewatir. Its not yet
> released. Me & Bret need to finalize on the syntax, method name etc so that
> its easier to use both with Watir/Firewatir.
>
> - Angrez
>
> On Wed, Oct 28, 2009 at 10:28 AM, Raveendran P <jazzezr...@gmail.com> wrote:
> > Hi Aedorn,
>
> >            I got some idea's from Selenium.I implemented it in my Watir
> > scripts. Have you tried this way?  -- >http://bit.ly/21zDrH
>
> >             Awaiting your reply
>
> > Thanks
>
> > On Wed, Oct 28, 2009 at 6:03 AM, Ethan <notet...@gmail.com> wrote:
>
> >> Yeah, you should be able to get a handle to the window where you enter
> >> username/password, get the text fields on that window, set them, click the
> >> 'ok' button. That'd all be in javascript over the jssh socket.
>
> >> On Tue, Oct 27, 2009 at 20:28, aidy lewis <aidy.le...@googlemail.com>wrote:
>
> >>> The Firefox browser is completly scriptable. I would suggest looking
> >>> at the Mozilla js classes.
>
> >>> 2009/10/27 Chris <christopher.mcma...@gmail.com>:

Željko Filipin

unread,
Oct 29, 2009, 10:03:06 AM10/29/09
to watir-...@googlegroups.com
On Thu, Oct 29, 2009 at 2:58 PM, Chris <christoph...@gmail.com> wrote:
> FWIW: http://chrismcmahonsblog.blogspot.com/2006/05/internet-explorer-basic-authorization.html

Chris,

Would you add this to Basic Authentication wiki page?

http://wiki.openqa.org/display/WTR/Basic+Authentication

Željko
--
watir.com - community manager
watirpodcast.com - host



Aedorn Varanis

unread,
Oct 29, 2009, 3:08:50 PM10/29/09
to watir-...@googlegroups.com
Internet Explorer solutions don't tend to work well with Firefox in Linux.

However, Angrez's fork had the solution so I'm using that now. Thanks Angrez, works perfectly!

Angrez Singh

unread,
Oct 29, 2009, 3:35:25 PM10/29/09
to watir-...@googlegroups.com
Thats great. I used it only on windows so it works on Linux as well. Happy to help
- Angrez

amol

unread,
Nov 10, 2009, 9:44:30 AM11/10/09
to Watir General
Hi All,

I want to handle basic authentication window on linux Please help me
for that i'm not able to handle that, as i handle that successfully in
windows

Regards,
Amol Khawre

On Oct 30, 12:35 am, Angrez Singh <ang...@gmail.com> wrote:
> Thats great. I used it only on windows so it works on Linux as well. Happy
> to help
> - Angrez
>
>
>
> On Fri, Oct 30, 2009 at 12:38 AM, Aedorn Varanis <aed...@gmail.com> wrote:
> > Internet Explorer solutions don't tend to work well with Firefox in Linux.
>
> > However, Angrez's fork had the solution so I'm using that now. Thanks
> > Angrez, works perfectly!
>
> > On Thu, Oct 29, 2009 at 7:58 AM, Chris <christopher.mcma...@gmail.com>wrote:
>
> >> FWIW:
> >>http://chrismcmahonsblog.blogspot.com/2006/05/internet-explorer-basic...

Angrez Singh

unread,
Nov 11, 2009, 12:47:24 AM11/11/09
to watir-...@googlegroups.com
Are you using FireWatir? If yes, then did you went through the entire thread?

- Angrez
Reply all
Reply to author
Forward
0 new messages