How to handle type of notification in selenium web driver.
Asked
Active
Viewed 60 times
0

Dadep
- 2,796
- 5
- 27
- 40

Sunil Kumawat
- 1
- 2
-
1show us first what you tried so far ? – cruisepandey May 28 '18 at 05:45
-
@Sunil Kumawat try this approach to handle this popup : https://www.guru99.com/alert-popup-handling-selenium.html – Zhivko.Kostadinov May 28 '18 at 06:57
-
Please provide some info, what You've tried, and what is the problem. – Kovacic May 28 '18 at 07:25
-
i was just trying to open facebook login page, then entering email id and password.then click on login button . after it i want to click on profile but when ever i tried this above mention pop up coming – Sunil Kumawat May 28 '18 at 10:48
-
got the solution – Sunil Kumawat May 28 '18 at 10:49
-
ChromeOptions options = new ChromeOptions(); options.addArguments("--disable-notifications"); ChromeDriver driver = new ChromeDriver(options); – Sunil Kumawat May 28 '18 at 10:50
-
above mention code disabling that notification – Sunil Kumawat May 28 '18 at 10:50
1 Answers
0
Hope you are trying to handle an alert window on a webpage while running.
Below code can help you out:
Alert alert = driver.switchTo().alert();
alert.accept();
You can also decline the alert box:
Alert alert = driver.switchTo().alert();
alert().dismiss();
Some useful links: Alert Notification

undetected Selenium
- 183,867
- 41
- 278
- 352

Priya P
- 123
- 1
- 4
- 11