Mobile QA Zone

A Mobile Application Testing Community

How can we handle web-based pop up in Selenium automation?

Views: 44

Reply to This

Replies to This Discussion

Web-based popup is otherwise known as server authentication popup. You can handle it by using below:

driver.get("http://username:password@@SiteURL") ;

Example: driver.get("http://dev:AEgbrLFw@www.mobileqazone.com/");

There are basically two types of alerts/pop-ups used in automation testing by software testing services

1. Web-based alert pop-ups
2. Windows-based alert pop-ups

What is Alert box/ Pop up box/:

Alert or pop-up is a small box which appears on the display to give some kind of information:

There are basically four methods which are used to handle the pop-up:

1) void dismiss() – The dismiss() method is used clicks on the “Cancel” button
2) void accept() – The accept() method is used clicks on the “Ok” button
3) String getText() – The getText() method returns the text displayed on the pop-up box.
4) void sendKeys(String stringToSend) – The sendKeys() method enters the specified string pattern into the pop-up box.

Alert alert = driver.switchTo().alert();
alert.accept();
driver.switchTo().alert().dismiss();
driver.switchTo().alert().accept();

RSS

© 2019   Created by Anurag Khode.   Powered by

Badges  |  Report an Issue  |  Terms of Service

Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.