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);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly