Skip to content

Commit

Permalink
Adding more examples of element mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Feb 26, 2024
1 parent cbc42be commit 28395d4
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,22 @@ public void mutatedElements() {
Assertions.assertEquals(mutations.get(0), driver.findElement(By.id("revealed")));
}

@Test
public void elementsMutation() {
driver.get("https://the-internet.herokuapp.com/dynamic_controls");

CopyOnWriteArrayList<WebElement> mutations = new CopyOnWriteArrayList<>();
((HasLogEvents) driver).onLogEvent(domMutation(e -> mutations.add(e.getElement())));

driver.findElement(By.cssSelector("#checkbox-example > button")).click();
wait.until(_d -> !mutations.isEmpty());

driver.findElement(By.cssSelector("#checkbox-example > button")).click();
wait.until(_d -> mutations.size() > 1);

Assertions.assertEquals(mutations.size(), 2);
}

@Test
public void consoleLogsBidiApi() {
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
Expand Down

0 comments on commit 28395d4

Please sign in to comment.