Reputation: 21
I am trying to handle authentication popup through my selenium test by passing username and password in URL.
I have tried following solutions:
I have a Maven project, I am trying to send url with username and password from project.properties file, which looks like this -
URL = https://username:password@URL
open url code-
WebDriver driver = new ChromeDriver();
driver.navigate.to(URL);
I get below error in browser console: "there has been a problem with your fetch operation: Failed to execute 'fetch' on 'Window': Request cannot be constructed from a URL that includes credentials"
Upvotes: 0
Views: 788
Reputation: 21
I am able to handle this using AutoIT script. The script looks something like this,
WinWaitActive("Sign in")
Sleep(5000)
Send("username")
Send("{TAB}")
Send("password")
Send("{ENTER}")
I run this script through my code,
WebDriver driver = new ChromeDriver();
Runtime.getRuntime().exec("(path)\AutoIt\script.exe");
driver.get(prop.getProperty(URL));
driver.navigate().refresh();
Upvotes: 1