UnexpectedAlertPresentException when there is no alert/popup

711 views
Skip to first unread message

Spencer Hanes

unread,
Sep 26, 2017, 12:22:10 PM9/26/17
to Selenium Users
Hello all,

I am having an issue where I am unable to do anything on a specific webpage because I get "UnexpectedAlertPresentException".
There is no alert or popup on this webpage. The only thing I can think is that the script that creates a custom right-click menu is messing with it.

I have tried various posts mentioning switching to and accepting the alert, but I get "NoAlertPresentException" when I try that.
I also know that this is not an issue where I need to wait for the alert, because I get the NoAlertPresentException even after I've waited for the page to load.

I am trying to use Selenium to pull up and scrape a dynamically generated webpage.
It was working with PhantomJS, but I moved to Firefox so I could see the page load.

Python 3.6.2
Firefox Nightly 58.0a1 (also tried on 55.0.3 with the same error)
geckodriver 0.19.0

If I'm missing some info that may be helpful, please let me know what I should grab.

Spence
Message has been deleted

Always a student

unread,
Oct 4, 2017, 11:09:27 AM10/4/17
to Selenium Users
I am also facing a similar issue. Started happening after upgrading Selenium.WebDriver, Selenium.Support and GeckDriver 0.19.0.

I am using AutoIT to login to a page, (since it requires authentication window interaction, which Selenium cant handle). After loggin in, it lands on home page and then no matter which element I triy to locate and what strategy I use for location, it returns a UnhandledAlertException. As the OP said, I also tried dealing with an alert that I cant see, by switching, accepting.. When I do that, it says there is no alert. But still, its not locating any elements at all. Below is what I get in Debug mode when I try to locate an element after logging in. I am using C#. Also notice that the message is empty. 

===========================================================
driver.FindElement(By.XPath("' threw an exception of type 'OpenQA.Selenium.UnhandledAlertException'
    Alert: {OpenQA.Selenium.UnhandledAlertException.UnhandledAlert}
    AlertText: ""
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233088
    HelpLink: null
    InnerException: null
    Message: ""
    Source: "WebDriver"
    StackTrace: "   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)\r\n   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)\r\n   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)\r\n   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath(String xpath)\r\n   at OpenQA.Selenium.By.<>c__DisplayClass19_0.<XPath>b__0(ISearchContext context)\r\n   at OpenQA.Selenium.By.FindElement(ISearchContext context)\r\n   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)"
    TargetSite: {Void UnpackAndThrowOnError(OpenQA.Selenium.Remote.Response)}
==========================================================

Below is my config.
Selenium.Support- Version 3.6.0
Selenium.WebDriver- Version 3.6.0
GeckoDriver - Version 0.19.0
Firefox Version 56.0 (tried on 54.0 and 55.0 also)

Always a student

unread,
Oct 5, 2017, 10:35:11 AM10/5/17
to Selenium Users
No one has replied to this yet. I found another post related to Safari browser, that is partially same as the issue I am seeing.Perhaps someone can more info from here and reply ?

it can be found here

Always a student

unread,
Oct 18, 2017, 3:26:28 PM10/18/17
to Selenium Users
No one has replied to this message yet but there seems to be a bug logged about this recently and also some workaround suggested here. 


Reply all
Reply to author
Forward
0 new messages