Selenium 4 Features Part-1 || Handling Browser TABS and New Windows

Опубликовано: 14 Январь 2025
на канале: Testers Talk
1,080
16

Selenium 4 Features Part-1 || Handling Browser TABS and New Windows #Selenium4 #SeleniumJavaTutorial #Automationtesting

For more interesting tutorials click on subscribe button & Bell icon.
https://www.youtube.com/c/BakkappaN_S...

Click on #LIKE and #SHARE with friends.
Important Notes:-
@Test
public void Test1() throws InterruptedException {
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
String sessionID=driver.getWindowHandle();
//driver.switchTo().newWindow(WindowType.TAB);
driver.switchTo().newWindow(WindowType.WINDOW);
driver.navigate().to("   / @testerstalk  ");
String channelName=driver.findElement(By.xpath("//*[@class='style-scope ytd-channel-name']")).getText();
System.out.println("Youtube channel name is : "+channelName);
driver.switchTo().window(sessionID);
driver.findElement(By.xpath("//*[@title='Search']")).sendKeys(channelName);
Thread.sleep(5000);
driver.quit();
}