I am having issues detecting Basic Auth alert with ChromeDriver 2.14 (Chrome 40.0.2214.111 (64-bit));
I am instantiating the driver like this:
new ChromeDriver(DesiredCapabilities.chrome());
and then navigate and wait for pop up:
driver.navigate().to(URL);
WebDriverWait wait = new WebDriverWait(driver, 10);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("test", "test"));
But it times out after 10 seconds with the error message no alert open. I can see that there is an alert open for basic auth.
Can you see anything wrong with the code or is it a bug with the driver?
I have seen some old question relating to a chromedriver bug. I haven't seen any other question relevant.
Thank you for your help.
Your question is similar to this question here
Authentication popup is NOT generated by Javascript / it is not a javascript alert. So It can not be handled by WebDriver. So the above behavior is expected.
Below authenticateUsing a beta method is not yet implemented.
alert.authenticateUsing(new UserAndPassword("test", "test"));
Related
In our application, when I navigate between web pages, system is showing attached Browser Confirmation Alert. I am using Robot framework to automate. I tried accepting or Dismissing the alert using 'Handle Alert' keyword. But i am observing 'Alert not found' error in report. Also right click is disabled to find web element in the Alert window.
*** Settings ***
Library Selenium2Library
Test Teardown Close Application
*** Variables ***
*** Test Cases ***
Dismiss Alert
Open Aplication
Click WebElement ${serchXpath}
Click WebElement ${navigateXpath}
Wait Until Element Is Visible ${Inv_xpath_all_rows} timeout=60 seconds
Handle Alert action=DISMISS timeout=60 s
Fails with : Alert not found in 5 seconds. at the line Handle Alert action=DISMISS timeout=60 s
I am new to Automation world, Request you to help me. Thanks a lot.
Looking at the screenshot of the popup attached, it looks like you are dealing with an "External Protocol Request" box. You cannot interact with this box using selenium webdriver API. Instead you need to handle this using ChromeOptions or by editing the Chrome profile. Here is a SO answer that describes how to go about it.
To handle the same in RobotFramework using Selenium2Library, check this out.
${chromeOptions}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
${exclude}= Create Dictionary "fasp"=True
${prefs}= Create Dictionary protocol_handler.excluded_schemes=${exclude}
Call Method ${chromeOptions} add_experimental_option prefs ${prefs}
Create Webdriver Chrome chrome_options=${chromeOptions}
Source: https://support.asperasoft.com/hc/en-us/articles/216660968-How-to-unblock-the-launching-of-Connect-3-6-5-in-Chrome
Using Asp.net mvc to develop an intranet portal. For some interactivity was used SignalR library.
While navigating through site pages found strange issue. When sometimes i try to hit "back" or "forward" buttons in Internet Explorer 9 nothing is happened. When hitting "back" button and preious page loaded "forward" button after a moment become unavailable.
When i place mouse cursor above these buttons it shows something like: "SignalR forever frame transport stream" or http://server/signalr/connect?transport=foreverFrameconnectiontoken=....
Is this by design and nothing to do with it or maybe some configurations can help me?
This issue appears to be a bug and #aleha has opened an issue on GitHub.
For now at least a good workaround is to disable the foreverFrame transport:
$.connection.hub.start({ transport: ['webSockets', 'serverSentEvents', 'longPolling'] }, function () { ... })
Stoping SignalR connection of Javascript client is slow (around 30 seconds).
I use SignalR, version 2.0.1 (but problem reproduced in 2.0.0 ) for webchat integrated to ASP.NET site. I have one .NET SignalR client(for other reason) and a lot of JS clients (chat clients). My test case is very simple. I want to disable chat on ASP.NET page. For this reason I try to stop SignalR connection using next code:
$.connection.hub.stop();
But onDisconnected method (on hub) was calling only after 30 seconds. I suppose that connection was stopped by disconnect timeout but not by Javascript code. I use LongPolling transpot by default.
var initObject = { transport: ["longPolling", "webSockets", "foreverFrame", "serverSentEvents"] };
$.connection.hub.start(initObject).done(function () {
...
}
Problem reproduce in last versions of Google Chrome but works fine in IE and Mozilla. What reason of so strange behaviour of SignalR and how can I avoid it?
For anyone else having this issue just use conn.Stop(new TimeSpan(0)) to kill the connection instantly.
conn.disconnect();
conn.stop();
hub.subscribe(null);
conn = null;
hub= null;
try this and let me know if it works.It works in android though.
The problem is solved by updating SignalR version to the 2.0.3.
When I try to launch any URL a proxy authentication dialog pops up for username and password. The code (java) stops once the dialog appears and doesn't move further or throw an exception.
How can i handle this?
Note: This is happening only with firefox(v 22.0). I am able to handle the authentication dialog in IE(v 7) using the Robot send keys.
Webdriver: selenium-server-standalone-2.35.0
Firefox version : 22.0
testNG version: 6.8.7
I think it is because you are trying to reach HTTP authenticated page. The workaround is send username and password in url request like this:
driver.get("http://username:password#your-test-site.com");
where driver is assumed healthy living instance of WebDriver
How to implement "Rememeber me" automation in Firefox with web driver? I am using web driver 2.20, Eclipse IDE, Firefox 9.0
The reason you are experiencing that is because every time you start firefox, webdriver creates a new anonymous profile with no cookies. You can make it use a particular profile, which should retain cookies.
File profileDir = new File("path/to/profile");
FirefoxProfile profile = new FirefoxProfile(profileDir);
WebDriver driver = new FirefoxDriver(profile);
FirefoxProfile has many other options, like adding extensions and all.
I understand you need a solution for firefox, but I have the below working version for Chrome. You can refer this link for a firefox solution: How to start Selenium RemoteWebDriver or WebDriver without clearing cookies or cache?
For Chrome (config): You have to set the path to user-dir which will save all the login info after you login for the first time. The next time you login again, login info from the user-dir will be taken.
System.setProperty("webdriver.chrome.driver", "res/chromedriver.exe");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("user-data-dir=D:/temp/");
capabilities.setCapability("chrome.binary","res/chromedriver.exe");
capabilities.setCapability(ChromeOptions.CAPABILITY,options);
WebDriver driver = new ChromeDriver(capabilities);
Login for the first time:
driver.get("https://gmail.com");
//Your login script typing username password, check 'keep me signed in' and so on
Close the driver (do NOT quit):
driver.close();
Re-initialize the driver and navigate to the site. You should not be asked for username and password again:
driver = new ChromeDriver(capabilities);
driver.get("http://gmail.com");
The above can be implemented for firefox using a firefox profile.