Wednesday, 3 February 2016

Selenium web driver switch commands

SWITCH TO COMMANDS IN SELENIUM WEB DRIVER:
==============================================

SWITCH TO:
===========
1.WINDOW
------------------
By using switch to command we can switch from one window to another window.

webdriver.switchTo().window(window name);

2.FRAMES
------------------
By using switch to command we can IDENTIFY FRAMES.

webdriver.switchTo().frame(frame name or frame id);


webdriver.switchTo().frame(frame index);


webdriver.switchTo().frame(webelement element);

3.ALERTS
---------------
By using switch to command we can HANDLE THE ALERTS IN SELENIUM.

Alert alert = webdriver.switchTo().alert();
alert.accept();
alert.dismiss();
alert.sendKeys();
alert.authentication();

4.DEFAULT WINDOWS
----------------------------------
By using switch to command we can switch to the default windows.

webdriver.switchTo().defaultContent();

No comments:

Post a Comment