1.

How are web-based pop-ups handled in Selenium?

Answer»

WebDriver offers an efficient way to HANDLE web-based pop-ups USING the Alert interface. Developers can use the below mentioned four METHODS, along with the Alert interface, for treating web-based pop-ups:

  • void dismiss(): Accept() way clicks “Cancel” when window pop-ups appear.
  • void accept(): Accept() method clicks “Ok” button when window pop-ups appear.
  • String getText(): GetText() method returns the text SHOWN on alert box.
  • void sendKeys(String stringToSend): SendKeys() method enters specified string pattern into alert box.


Discussion

No Comment Found