Reputation: 173
This is a sort of a URL which I need to use to automate my application using Selenium RC, http://user:[email protected].
My question: Is this format really supported by IE 9? I can see it works perfectly in FF.
This works same in IE with the webdriverobject.get("url")
method, but what happens in RC?
Nothing worked.
com.thoughtworks.selenium.SeleniumException: Failed to navigate to http://demo:[email protected]:28000/Windchill/app/?forceTrail=true. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 50 milliseconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'SNARAIN0D1', ip: '132.253.12.169', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_55'
Session ID: 7790e5d1-daaf-4c1f-b359-672d2104b13b
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0,
Upvotes: 1
Views: 334
Reputation: 336
Internet Explorer does not support username & password in URL. Refer http://support.microsoft.com/kb/834489
To handle authentication popup in IE you have to use third party tool like AutoIt or Robot class. I tried it successfully using java Robot class:
driver.get("http://www.test.com");
StringSelection stringSelection = new StringSelection("password");
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
Robot robot = new Robot();
Alert alert = driver.switchTo().alert();
alert.sendKeys("username");
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
try {
(new Robot()).keyPress(java.awt.event.KeyEvent.VK_ENTER);
(new Robot()).keyRelease(java.awt.event.KeyEvent.VK_ENTER);
} catch (AWTException e) {
e.printStackTrace();
}
//alert.accept();
Thread.sleep(2000);
Upvotes: 2