How To Switch Windows in Selenium | How to Handle Multiple windows in Selenium.
Автор: Azhar Techno Coder
Загружено: 2023-03-30
Просмотров: 741
How To Switch Windows in Selenium | How to Handle Multiple windows in Selenium.
Code:
package com.general.interviewQuestions;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class driverQuitNavigate {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("https://demoqa.com/browser-windows");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
String parentWindow = driver.getWindowHandle();
driver.findElement(By.id("windowButton")).click();
for(String windowHandles: driver.getWindowHandles()) {
if(!windowHandles.equals(parentWindow)) {
driver.switchTo().window(windowHandles);
Thread.sleep(3000);
driver.close();
}
}
}
}
Chapters:
0:00 - Introduction to the video
0:18 - Explaining the logic of the program.
0:45 - Program to Handle Multiple windows in Selenium.
4:46 - Execution of the program.
Next Steps :
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists
► 1. Javascript - • Javascript Factory
► 2. Puppetter - • Puppeteer
► 3. Cypress - • Cypress
► 4. Tech works - • Видео
► 5. Vbscript Basics To Advanced - • VBScript Part 1 - Features Advantages Dis...
► 6. Jmeter - • Jmeter Tutorials
► 7. Excel - • Videos On Excel
► 8. Appium - • Appium
► 9. Shares - • Shares
► 10. Javascript Interview Questions - • Javascript Interview Questions
► 11. C# Tutorials - • C# Factory
► 12. HTML & CSS - • HTML & CSS
► 13. Browser Console - • Browser Console
► 14. JSON - • Videos on Json
► 15. Specflow - • Specflow Tutorials
► 16. MongoDB - • MongoDB Tutorials
► 17. Postman - • Postman
► 18. Python - • Python
► 19. Typescript - • Typescript & Node Imp Questions
► 20. Node - • Node
► 21. Java Selenium Interview Questions: • Java and Selenium Imp
► 22. Real Time Interview Q & A: • Real Time Interview Questions
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: