Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR unexpected alert open: Interstitial popups not supported #7834

Closed
cosminPintea opened this issue Dec 2, 2019 · 10 comments
Closed

ERROR unexpected alert open: Interstitial popups not supported #7834

cosminPintea opened this issue Dec 2, 2019 · 10 comments
Assignees

Comments

@cosminPintea
Copy link

cosminPintea commented Dec 2, 2019

🐛 Bug Report

Try to login using "https://login.microsoftonline.com/". The chromedriver throw an exception when try to handle the login alert.

To Reproduce

The log:

[1575292159.007][INFO]: Done waiting for pending navigations. Status: ok
[1575292159.007][INFO]: [d37bc508d460fa85d6d08d56feef02d7] RESPONSE GetAlertMessage ERROR no such alert
  (Session info: chrome=78.0.3904.108)
[1575292170.996][INFO]: [d37bc508d460fa85d6d08d56feef02d7] COMMAND GetAlertMessage {

}
[1575292170.996][DEBUG]: DevTools WebSocket Event: Page.frameScheduledNavigation AA22BF04E772DB54C00E7CDCD23AF4B7 {
   "delay": 0,
   "frameId": "AA22BF04E772DB54C00E7CDCD23AF4B7",
   "reason": "scriptInitiated",
   "url": "https://xxxxxxx/adfs/ls/?client-request-id=xxxxxxxx&wa=wsignin1.0&wtrealm=urn%3afederation%3aMicrosoftOnline&wctx=LoginOptions%3D3%26estsredirect%3d2%26est..."
}
[1575292170.996][DEBUG]: DevTools WebSocket Event: Page.frameRequestedNavigation AA22BF04E772DB54C00E7CDCD23AF4B7 {
   "frameId": "AA22BF04E772DB54C00E7CDCD23AF4B7",
   "reason": "scriptInitiated",
   "url": "https://xxxxxxxx/adfs/ls/?client-request-id=2xxxxxxxxxxxx&wa=wsignin1.0&wtrealm=urn%3afederation%3aMicrosoftOnline&wctx=LoginOptions%3D3%26estsredirect%3d2%26est..."
}
[1575292170.996][DEBUG]: DevTools WebSocket Event: Page.frameStartedLoading AA22BF04E772DB54C00E7CDCD23AF4B7 {
   "frameId": "AA22BF04E772DB54C00E7CDCD23AF4B7"
}
[1575292170.996][DEBUG]: DevTools WebSocket Event: Page.frameClearedScheduledNavigation AA22BF04E772DB54C00E7CDCD23AF4B7 {
   "frameId": "AA22BF04E772DB54C00E7CDCD23AF4B7"
}
[1575292170.996][DEBUG]: DevTools WebSocket Event: Page.interstitialShown AA22BF04E772DB54C00E7CDCD23AF4B7 {

}
[1575292170.996][DEBUG]: DevTools WebSocket Command: Page.stopLoading (id=278) AA22BF04E772DB54C00E7CDCD23AF4B7 {

}
[1575292170.996][INFO]: [d37bc508d460fa85d6d08d56feef02d7] RESPONSE GetAlertMessage ERROR unexpected alert open: Interstitial popups not supported
  (Session info: chrome=78.0.3904.108)

Expected behavior

To be able to handle the alert generated by the login process.

Test script or set of commands reproducing this issue

WebDriver.Navigate().GoToUrl(startUrl); WebDriver.FindElement(By.XPath("//input[@type='email']")).SendKeys(email); WebDriver.FindElement(By.XPath("//input[@value='Next']"),Click(); Thread.Sleep(2000); //Switch to the alert IAlert alertHandler = WebDriver.SwitchTo().Alert(); alertHandler.SetAuthenticationCredentials("email", "psw"); WebDriver.SwitchTo().DefaultContent();

Environment

OS: Windows 10
Browser: Chrome
Browser version: 78.0.3904.108
Browser Driver version: Selenium.WebDriver.ChromeDriver 78.0.3904.7000
Language Bindings version: c# Selenium.WebDriver.ChromeDriver 78.0.3904.7000

@diemol
Copy link
Member

diemol commented Dec 5, 2019

@cosminPintea
I wrote script based on the issue description and I never got an alert, could you please add the exact automation script you are using?

@cosminPintea
Copy link
Author

cosminPintea commented Dec 9, 2019

Hi,
Here is the alert that trigger that exception (see screenshot). The application use adfs to do the user authentication. Also the acces is done over the VPN.
image

I understand that in some cases the alert is not triggered (probably the alert is caused by our app authentication logic). The question here is : in case the alert is triggered why the chrome driver throw an unhandled exception? There is any workaround of this situation?
Because of our test environment (handles chrome in an lambda function) i cant use custom profile for the login and also i cant use "chromeOptions.AddExtension" approach.

@dlumpp
Copy link

dlumpp commented Dec 11, 2019

I have a similar problem that seems to be related. I started noticing it on December 3rd.

Chrome driver throws an unhandled exception trying to dismiss an alert opened by a beforeunload event to remind users they have unsaved changes.

What's strange is that it doesn't always happen so it can't be reliably reproduced. It seems a socket gets closed sometimes. Here is a stack trace and log that may help.

[1576077823.508][DEBUG]: DevTools WebSocket Event: Page.frameScheduledNavigation 310B0EBC9D06C0A0B478B743B59262CE {
   "delay": 0,
   "frameId": "310B0EBC9D06C0A0B478B743B59262CE",
   "reason": "scriptInitiated",
   "url": "http://localhost/Default/Test/Conversation/Detail/12"
}
[1576077823.508][DEBUG]: DevTools WebSocket Event: Page.frameRequestedNavigation 310B0EBC9D06C0A0B478B743B59262CE {
   "frameId": "310B0EBC9D06C0A0B478B743B59262CE",
   "reason": "scriptInitiated",
   "url": "http://localhost/Default/Test/Conversation/Detail/12"
}
[1576077823.509][DEBUG]: DevTools WebSocket Event: Page.javascriptDialogOpening 310B0EBC9D06C0A0B478B743B59262CE {
   "defaultPrompt": "",
   "hasBrowserHandler": true,
   "message": "",
   "type": "beforeunload",
   "url": "http://localhost/Default/Test/DocumentCreation/Create?conversationId=12&expectedChildId=12&templateId=21"
}
[1576077823.509][DEBUG]: DevTools WebSocket Command: Inspector.enable (id=22077) 310B0EBC9D06C0A0B478B743B59262CE {
   "purpose": "detect if alert blocked any cmds"
}
[1576077823.515][DEBUG]: DevTools WebSocket Response: Inspector.enable (id=22077) 310B0EBC9D06C0A0B478B743B59262CE {

}
[1576077823.515][INFO]: Done waiting for pending navigations. Status: unexpected alert open
[1576077823.515][INFO]: [5739b4bf72857c46cec532622e20ee55] RESPONSE FindElement ERROR unexpected alert open
  (Session info: chrome=78.0.3904.108)
OpenQA.Selenium.WebDriverException
Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:1802
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
   at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByClassName(String className)
   at OpenQA.Selenium.By.<>c__DisplayClass20_0.<ClassName>b__0(ISearchContext context)
   at OpenQA.Selenium.By.FindElement(ISearchContext context)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
   at IX.Specs.Web.UI.Core.WebDriver.FindElement(By by) in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI.Core\WebDriver.cs:line 31
   at IX.Specs.Web.UI.Core.WebElements.WebElement.GetElement() in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI.Core\WebElements\WebElement.cs:line 46
   at IX.Specs.Web.UI.Core.WebElements.WebElement.get_Displayed() in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI.Core\WebElements\WebElement.cs:line 128
   at IX.Specs.Web.UI.Core.BaseUiFeatureSteps.DismissAnyOpenModals() in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI.Core\BaseUiFeatureSteps.cs:line 88
   at IX.Specs.Web.UI.SpecFlowHooks.CloseAnyOpenModals() in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI\SpecFlowHooks.cs:line 73
   at IX.Specs.Web.UI.SpecFlowHooks.CompleteActionsAfterScenario() in C:\Users\Vicky.Dummermuth\source\repos\JARVIS\IX.Specs.Web.UI\SpecFlowHooks.cs:line 67
   at lambda_method(Closure , IContextManager )
   at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) in D:\a\1\s\TechTalk.SpecFlow\Bindings\BindingInvoker.cs:line 69
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 245
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType hookType) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 234
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 215
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnScenarioEnd() in D:\a\1\s\TechTalk.SpecFlow\Infrastructure\TestExecutionEngine.cs:line 176
   at TechTalk.SpecFlow.TestRunner.OnScenarioEnd() in D:\a\1\s\TechTalk.SpecFlow\TestRunner.cs:line 64
   at IX.Specs.Web.UI.SysAdmin.Templates.ConsolidationSidePanelValidationFeature.ScenarioTearDown()
   at IX.Specs.Web.UI.SysAdmin.Templates.ConsolidationSidePanelValidationFeature.System.IDisposable.Dispose()
   at Xunit.Sdk.ExecutionTimer.Aggregate(Action action) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 31
   at ReflectionAbstractionExtensions.DisposeTestClass(ITest test, Object testClass, IMessageBus messageBus, ExecutionTimer timer, CancellationTokenSource cancellationTokenSource) in C:\Dev\xunit\xunit\src\xunit.execution\Extensions\ReflectionAbstractionExtensions.cs:line 79
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass47_0.<RunAsync>b__1() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 216
   at Xunit.Sdk.ExceptionAggregator.Run(Action code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 73

@cosminPintea
Copy link
Author

I have 100% reproducibility, basically i can't do the authentication by entering the user/psw. I use a custom profile with saved credential to do the login part.

@dlumpp
Copy link

dlumpp commented Dec 16, 2019

Updating to ChromeDriver 79 fixed my problem. I think it was due to this bug with alert messages. Maybe this will help you too @cosminPintea

@cosminPintea
Copy link
Author

I have updated the ChromeDriver to "Starting ChromeDriver 79.0.3945.36" . Now the exception "Interstitial popups not supported" is gone .
Now the line "IAlert alertHandler = _testBase.WebDriver.SwitchTo().Alert();" throw:

no such alert
(Session info: chrome=79.0.3945.79)
(Driver info: chromedriver=79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}),platform=Windows NT 10.0.18363 x86_64)

This is not a time issue. I just break the code before the "Alert" wait the alert to pop-up and execute the command ""IAlert alertHandler = _testBase.WebDriver.SwitchTo().Alert();".
The alert is the same one from the screenshot above.

@diemol
Copy link
Member

diemol commented Dec 22, 2019

If you manually interrupt the running script and wait for the alert so the code works, it means that it is indeed a timing issue. Again, we can only find a way to help if you provide us with a script to reproduce the issue.

@cosminPintea
Copy link
Author

cosminPintea commented Dec 23, 2019

Sorry, probably my description was not clear. I have the same behavior (exception :no alert found) when i break the code wait the pop-pup and after that continue execution.
The code is pretty simple. I try to login (see the login page in the screenshot), and execute the code:

WebDriver.Navigate().GoToUrl(startUrl); WebDriver.FindElement(By.XPath("//input[@type='email']")).SendKeys(email); WebDriver.FindElement(By.XPath("//input[@value='Next']"),Click();
Thread.Sleep(2000);
//Switch to the alert
IAlert alertHandler = WebDriver.SwitchTo().Alert();
alertHandler.SetAuthenticationCredentials("email", "psw");
WebDriver.SwitchTo().DefaultContent();

Before this last update of the chromeDriver the exception thrown was the one in the issue title. Right now it throw the classical exception that there is no alert. The app is stored in AWS and it is a internal app. It can be accessed form outside.The app login use "adfs" to do users authentication.
There are alerts types that are not handled by chromedriver?

@AutomatedTester
Copy link
Member

authentication prompts are not currently supported. This needs to be added to the webdriver spec, see w3c/webdriver#385, and then added to browsers

@lock
Copy link

lock bot commented Apr 18, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants