Ledjon
Ledjon

Reputation: 123

Unable to click “Allow” or “Block” in Permission popup in Chrome browser using Selenium?

I can’t click on “allow” in the permission pop up. I tried this, but it didn't work.

WebDriver driver= DriverFactory.getDriver();
Alert al= driver.switchTo().alert();
al.accept();

Does it exist any other option to handle the click of Chrome Browser pop ups. Thanks in advance.

Upvotes: 1

Views: 731

Answers (1)

Poçi
Poçi

Reputation: 253

It happened to me too First create a java.awt.Robot instance,

Then call keyPress() method on robot

  • Then do (VK_TAB) then (VK_ENTER)

(VK_TAB) is used to go to ‘Allow’ button, then (VK_ENTER) clicks it.

Upvotes: 1

Related Questions