Window & Frame

 1. What does the switch command use?

The switch is used to switch between windows, frames, pop-ups…

2. Write code to switch between multiple Windows

driver.switchTo.window(handle)
for(String handle : driver.getWindowHandles()){
driver.switchTo.window(handle)}

3. How to maximize the window?

driver.manage.window.maximize();

4. How to handle multiple tabs and windows in Selenium?

using getWindowHandles() method

5. Difference between getWindowHandle() and getWindowHandles() methods?

  1. windowHanlde is a unique identifier.
  2. getWindowHandle(): return single handle. A String value
  3. getWindowHandles(): Return set of handles: Set of String values

6. How to switch between multiple tabs?

driver.switchTo().window(windowHandle)

7. What does window handle mean?

It is a unique identifier of each window. It is a String value. It can be used to switch between tabs.

8. What is an iframe?

  1. It is called an inline frame. 
  2. they are HTML documents embedded within other HTML documents.

9. How to automate iframe-related scenarios?

  1. need to use switchTo() method as below
    driver.switchTo().frame();

10. How to come back to the main content once iframe functionalities are done?

  1. need to switch back to the main frame
driver.switchTo().frame();
...

driver.switchTo().defaultContent(); or

driver.switchTo().parentFrame();

11. What parameters can be passed inside the frame() method?

  1. frame(index)
  2. frame(name)
  3. frame(id)
  4. frame(WebElement)

No comments:

Post a Comment

Cucumber

What is Cucumber? Definition : Cucumber is an open-source tool that supports BDD . Purpose : Bridges the communication gap between business ...