0

I am trying to get rif od an alert as displayed in the image:

enter image description here

This alert can be easily dismmised by pressing escape or return keys. But I cannot get it done using selenium.

First, I am switching to the window using:

m_parentWindowHandler = m_chromeWebdriver.getWindowHandle();
.
.
.
m_chromeWebdriver.switchTo().window(m_parentWindowHandler);

Then I tried

    Actions action = new Actions(m_chromeWebdriver);
    action.sendKeys(Keys.RETURN).build().perform();

(also with Keys.ESCAPE)

Nimantha
  • 6,405
  • 6
  • 28
  • 69
dushkin
  • 1,939
  • 3
  • 37
  • 82
  • 2
    Have a look this. Seems to be a duplicate .--- http://stackoverflow.com/questions/8244723/alert-handling-in-selenium-webdriver-selenium-2-with-java – Grasshopper Aug 14 '16 at 14:56
  • 1
    The dialog comes from PDF viewer. If you don't care about this dialog, and just want to get rid of it, you could disable Chrome PDF Viewer in chrome://plugins/ – timbre timbre Aug 14 '16 at 15:24
  • @KirilS. Thanks. This would be a sufficient solution for me. – dushkin Aug 15 '16 at 06:57

0 Answers0