0

I'm using Selenium and webDriver and C#. I want to write some code to access a webpage automatically. And there will popup an authorize window (two input control, ex.user should press "admin" and password "admin", then click button "OK").

My code is:

IAlert alert = driver.SwitchTo().Alert();
alert.Sendkeys("admin");
alert.Sendkeys("\t");     // it not works. FAILED!
alert.Sendkeys("admin");
alert.Accept();`

My Question is how can I enter name/password into the popup window correctly? How Selenium handle the popup window like these?

Any comments are welcome.

Unihedron
  • 10,902
  • 13
  • 62
  • 72
  • It is a Window pop up or javascript pop up? – Sham Nov 05 '14 at 09:55
  • possible duplicate of [Selenium Webdriver and Basic Auth in IE](http://stackoverflow.com/questions/16572956/selenium-webdriver-and-basic-auth-in-ie) also: http://stackoverflow.com/questions/5672407/basic-authentication-in-selenium-2-set-up-for-firefoxdriver-chromedriver-and and http://stackoverflow.com/questions/24304752/how-to-handle-authentication-popup-with-selenium-webdriver – krokodilko Nov 06 '14 at 18:36
  • It is a Window pop up I think. – Fang Jie Yu Nov 10 '14 at 02:00

1 Answers1

0

If you mean Http Basic auth window:

enter image description here

Try change URL to: http://user:password@www.yourserveradress.com

Andrew_STOP_RU_WAR_IN_UA
  • 9,318
  • 5
  • 65
  • 101