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?
- windowHanlde is a unique identifier.
- getWindowHandle(): return single handle. A String value
- 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?
- It is called an inline frame.
- they are HTML documents embedded within other HTML documents.
9. How to automate iframe-related scenarios?
- need to use switchTo() method as below
driver.switchTo().frame();
10. How to come back to the main content once iframe functionalities are done?
- 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?
- frame(index)
- frame(name)
- frame(id)
- frame(WebElement)
No comments:
Post a Comment