Selenium WebDriver Flashcards
1
Q
How to Handle Multiple Windows In Selenium WebDriver?
A
With WindowHandle.
String currentWindowHandle = driver.getWindowHandle(); findElement(By.linkText("aaa)).click(); String newWindowTabHandle = driver.getWindowHandles().stream() .filter(h -> !h.equals(currentWindowHandle)).findFirst().get(); driver.switchTo().window(newWindowTabHandle);
2
Q
Types of assertion in testNG
A
Soft Asserts, Hard Asserts and Verify.
Soft Asserts are not included by default and need a separate package. They will not stop the test from continuing execution.
Hard Asserts throw Exception and move to the next @Test.