Green
Green

Reputation: 1465

java webdriver access to restricted site

I'm wondering how I can log in to a site that is restricted, using WebDriver. When you get to the site it says: "The server (server name) requires a username and password. the server says: Restricted Files." This message box does not provide the option to inspect element or see any source, so I can't get a frame name or anything. Is there a way to handle this? this is a dev site and is protected. Let me know if more information is needed.

Upvotes: 0

Views: 467

Answers (1)

Pavel Janicek
Pavel Janicek

Reputation: 14738

There is only way to do this - send username in the URL. so if the site is for example http://www.example.com/restricted.html you have to access it like this

driver.get("http://username:[email protected]/restricted.html");

The above pseudocode applies to Webdriver in Java, where driver is valid instance of WebDriver

Upvotes: 3

Related Questions