basic authentication not working with wptdriver

Hi,

I’ve noticed the following in wptdriver-controlled browsers (FF7 and actual Chrome) with wpt 2.5 and 2.6:
The basic http-authentication works for IE but tests fail using wptdriver-controlled browsers. The popup for authentication opens and nothing happens til timeout.

As a workaround I am using wpt-script with command setHeader for setting an authentication-header.

Regards, Nils

Hi,

I’m having the same issue. Could anybody please tell me the right syntax for setting an authentication-header? I thought I got, cause one of my tests came up with results, but now it’s still ending in timouts or errors.

What I tried on my WPT (Desktop-) Instance to test with a wptdriver-controlled FF browser was the following:

  • filling in username and password at the “Auth” tab
  • filling in a command for setHeader at the “Script” tab like this
navigate    http://my-domain-with-authorization.com
setHeader('Authorization','Basic ' + EncodingUtil.base64Encode('MyUsername' + ':' + 'MyPassword'))

I guess I need a litte help :slight_smile:
Regards

User name and password in the auth tab should work as long as the auth is “basic” and it doesn’t require something fancier. I’m not 100% sure that Auth support was added for Firefox/Chrome though which may be why you are having an issue.

If you use a script then you need to reverse the order of the commands and use the correct syntax for the setHeader command.

Something like:

setHeader Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
navigate http://my-domain-with-authorization.com

Great! It’s working now!!

I encoded my “username:password” string with a Base64 Encoding tool and put the commands you mentioned inside my “Navigation Script” textarea.

Thanks Patrick!

I have authentication site want to do performance testing how I do it ?

Note

  • I filled in username and password at the “Auth” tab
  • I filled in a command for setHeader at the “Script” tab like this
    Code:
    navigate http://my-domain-with-authorization.com
    setHeader(‘Authorization’,'Basic ’ + EncodingUtil.base64Encode(‘MyUsername’ + ‘:’ + ‘MyPassword’))

but I can’t make sure WPT access my site
“screen shots” don’t show that
Regards
M.Harby

Does your site use BASIC auth or is it a html-based login? Your script is also completely wrong if you look above. The setHeader command needs to come before the navigate and it should look like:

setHeader Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==