1

Directly typing the below url in the browser, it works,

http://username:p%40ssword@examplesite.com:80/yyyy

But, when i use the same url, for selenium webdriver tests, it is connecting to

http://examplesite.com/yyyy

and asking for the HTTP authentication. Do i need to change any settings in the chrome browser, or tweak the default profile?

Vignesh Paramasivam
  • 2,360
  • 5
  • 26
  • 57
  • What are you trying to achieve by doing this ? Are you trying to login? – Madusudanan Nov 07 '14 at 10:52
  • i have mentioned clearly in question about `http url authentication`. – Vignesh Paramasivam Nov 07 '14 at 10:54
  • And why exactly you are using selenium to do this ? It is a browser testing tool. – Madusudanan Nov 07 '14 at 10:55
  • I'm gonna automate the website, in order to do that i need to get that from the server, and the server requires authentication through HTTP protocol. – Vignesh Paramasivam Nov 07 '14 at 11:00
  • 1
    That is the reason why I asked you that question in the first place, what do you intend to do after login, because testing the login itself using selenium is not a good approach.You can check here -http://stackoverflow.com/questions/3021602/http-basic-auth-via-url-in-firefox-does-not-work.But this does not work in chrome.What page does the login brings?Does it come like a Javascript popup? – Madusudanan Nov 07 '14 at 11:04
  • The link displays the exact problem i'm facing with. But only difference is it is chrome. if i provide the http auth only then i can able to view my website. Yes it displays a popup for http auth, which can't be accessed by selenium – Vignesh Paramasivam Nov 07 '14 at 11:54
  • You can use Java AWT which simulates keystrokes or even AutoIT.Check here for something similar - https://github.com/Madusudanan/Selenium/blob/master/WindowsAuthHandler.java – Madusudanan Nov 07 '14 at 12:27
  • yes i do know that, but i wonder why it is not working using url. That too only while using selenium. – Vignesh Paramasivam Nov 07 '14 at 12:33
  • Passing via URL is pretty old way of doing it and to answer that question we have to look in how chrome handles that.Which makes it an entirely different question altogether. – Madusudanan Nov 07 '14 at 12:35
  • See [this issue](https://code.google.com/p/selenium/issues/detail?id=34&q=http%20authentication&colspec=ID%20Stars%20Type%20Status%20Priority%20Milestone%20Owner%20Summary) logged with WebDriver. There are few people who reported this as working, some others developed helpers/plugins this issue is marked as an enhancement. So at the moment the driver itself has no support for basic authentication. The other aspect is the implementation of the chrome driver itself which might be a limiting factor. – shri046 Nov 07 '14 at 14:02

1 Answers1

0

That strategy did not work for me though. However I circumvented it by using AutoIt akin to this https://stackoverflow.com/a/19374325/5059472

Plain old npm install of autoit is not enough. We need to add python to our path, as well as install visual studio community 2015 with visual c++ selected as an additional option

Community
  • 1
  • 1
Karan Bhandari
  • 370
  • 3
  • 12