Unable To Handle Alert/PopUp with No Such Alert Exception In Selenium

727 views
Skip to first unread message

swati dave

unread,
Jun 20, 2019, 4:18:37 AM6/20/19
to Selenium Users
Hi,

I am facing issue in handling alert shown while performing some steps in my test application, Please find below details for same.Requesting to please help in same.

Steps ToBe Automated:'
  1. Navigating to APP URL
  2. Click on 'Deduct' button shown in page
  3. After above step Popup/Alert get display with 'Cancel' & 'Link Text'.so click on Cancel button
  4. Pop up get closed and need to click on shown 'Already installed' button.
Issue:Unable to switch to alert, and without clicking on 'Cancel' button in pop up, nothing can be clicked on shown web page.(PFA attached screenshots)

Things I have tried:
  1. alert class 
  2. clicking on enter button by action class (manually the pop up get closed by hitting enter key)
  3. used disable notification chrome option, if this alert is browser level alert.
  4. Used 'setexperimental' class with prefers for chrome option for handling notification.

Code:

wait = new WebDriverWait(driver,120);

                   driver.manage().timeouts().implicitlyWait(70, TimeUnit.SECONDS);

Alert alt;


                                    driver.get("https://jioapps2.ril.com"); //navigated URL

  try {

                                if (driver.findElement(By.id("protocolhandler-welcome-installButton")).isDisplayed()) {

                                   driver.findElement(By.id("protocolhandler-welcome-installButton")).click(); //clicked on deduct button

                                   Thread.sleep(300);

                                   }

                } catch (Exception e) {

                                e.printStackTrace();

                                System.out.println("install button");

                }

try {                          

                                 alt= wait.until(ExpectedConditions.alertIsPresent());

                                alt=  driver.switchTo().alert();      //used alert class fro handling shown alert

                                alt.dismiss();                  //tried with alt.accept also

                                ;                                                                             

                               

                } catch (Exception e) {

                               

                                e.printStackTrace();

                                System.out.println("alert not presnt");

                               

                }

try {

                                                if (driver.findElement(By.id("protocolhandler-detect-alreadyInstalledLink")).isDisplayed()) {

                                                   driver.findElement(By.id("protocolhandler-detect-alreadyInstalledLink")).click();   //clicking on 'already installed' button

                                                   Thread.sleep(300);

                                                   }

                                } catch (Exception e) {

                                                // TODO Auto-generated catch block

                                                e.printStackTrace();

}



Error:

org.openqa.selenium.TimeoutException: Expected condition failed: waiting for alert to be present (tried for 120 second(s) with 500 MILLISECONDS interval)

Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:20:39.408Z'

System info: host: 'VMJCCSELENIUM', ip: '10.141.108.84', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'

Driver info: org.openqa.selenium.remote.RemoteWebDriver

Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.100, chrome: {chromedriverVersion: 75.0.3770.8 (681f24ea911fe7..., userDataDir: C:\Users\swati.dave\AppData...}, goog:chromeOptions: {debuggerAddress: localhost:55013}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: edc930f87064997bfe172caec4d...}

Session ID: edc930f87064997bfe172caec4de203e

      at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:82)

      at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231)

      at com.jio.jioccpackage.JIOCC_Run_On_Node_Citrix.Launch_Bbrowser(JIOCC_Run_On_Node_Citrix.java:152)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:498)

      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)

      at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)

      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)

      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)

      at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)

      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)

      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)

      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

      at org.testng.TestRunner.privateRun(TestRunner.java:648)

      at org.testng.TestRunner.run(TestRunner.java:505)

      at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)

      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)

      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)

      at org.testng.SuiteRunner.run(SuiteRunner.java:364)

      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)

      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)

      at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)

      at org.testng.TestNG.runSuites(TestNG.java:1028)

      at org.testng.TestNG.run(TestNG.java:996)

      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

alert not presnt

org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a id="protocolhandler-detect-alreadyInstalledLink" class="detect-already-installed web-screen-link _ctxstxt_AlreadyInstalled" href="#">...</a> is not clickable at point (712, 444). Other element would receive the click: <p class="_ctxstxt_LicenseAgreementContentText">...</p>

  (Session info: chrome=75.0.3770.100)

Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:20:39.408Z'

System info: host: 'VMJCCSELENIUM', ip: '10.141.108.84', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'

Driver info: org.openqa.selenium.remote.RemoteWebDriver

Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.100, chrome: {chromedriverVersion: 75.0.3770.8 (681f24ea911fe7..., userDataDir: C:\Users\swati.dave\AppData...}, goog:chromeOptions: {debuggerAddress: localhost:55013}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: edc930f87064997bfe172caec4d...}

Session ID: edc930f87064997bfe172caec4de203e

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)

      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)

      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)

      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)

      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)

      at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279)

      at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)

      at com.jio.jioccpackage.JIOCC_Run_On_Node_Citrix.Launch_Bbrowser(JIOCC_Run_On_Node_Citrix.java:194)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:498)

      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)

      at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)

      at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)

      at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)

      at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)

      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)

      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)

      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)

      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

      at org.testng.TestRunner.privateRun(TestRunner.java:648)

      at org.testng.TestRunner.run(TestRunner.java:505)

      at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)

      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)

      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)

      at org.testng.SuiteRunner.run(SuiteRunner.java:364)

      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)

      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)

      at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)

      at org.testng.TestNG.runSuites(TestNG.java:1028)

      at org.testng.TestNG.run(TestNG.java:996)

      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)

      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


Screenshots.docx

Joe Ward

unread,
Jun 20, 2019, 4:38:04 AM6/20/19
to seleniu...@googlegroups.com
Is this actually an alert in the traditional sense? The steps you have described make it sound more like a UI modal.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/2be4cfea-6e8e-4527-914b-c157d30d6274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

swati dave

unread,
Jun 20, 2019, 6:03:33 AM6/20/19
to seleniu...@googlegroups.com
I am not sure about this that whether it is modal or alert or browser level notification.

Can u help in Same to know what kind of alert is this and if it is modal than how we can handle it.
Thanks 

Venu Adhi

unread,
Jun 20, 2019, 8:15:45 AM6/20/19
to Selenium Users
Alert - It's a javascript alert based on code validation or input validation.
Modal Window - will be part of your application... Dev will call this window upon some actions.

to check if it's an modal window see you can able to inspect the elements...

If you are able to access the window using keyboard shortcut you can handle using Enum Keys
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seleniu...@googlegroups.com.

swati dave

unread,
Jun 20, 2019, 8:50:32 AM6/20/19
to seleniu...@googlegroups.com
Hi

I have tried with keyboard event by action class but it's not working

Thanks 

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

swati dave

unread,
Jun 24, 2019, 2:22:58 PM6/24/19
to Selenium Users
Hi
Can anyone please help.in this issue

Regards
Swati

Joe Ward

unread,
Jun 24, 2019, 2:44:04 PM6/24/19
to seleniu...@googlegroups.com
Honestly, I think we've already tried all we can with the limited amount of information you've provided.

If you need more assistance consider providing more information.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

sachin patil

unread,
Jun 25, 2019, 12:24:06 AM6/25/19
to seleniu...@googlegroups.com

But where you want to click?


Can you please provide info?

Best Regard
Sachin Patil



Reply all
Reply to author
Forward
0 new messages