2

In selenium 4, you can wait for an element's presence but I am unable to find alternates if I want to wait for an element to become invisible or Clickable, or an alert to appear. Following mentioned statements are not working in selenium 4 as this version of Until is deprecated

if (KeyWord.contains("Visibility")) {
    wait.until(ExpectedConditions.visibilityOf(element)); // waiting for the element to be visible
} else if (KeyWord.contains("Click")) {                  
   wait.until(ExpectedConditions.elementToBeClickable(element)); // waiting for the element to be Clickable
} else if (KeyWord.contains("Frame")) {
   wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(element)); // waiting for the frame to be available and switch to it
} else if (KeyWord.contains("Invisibility")) {                   
    wait.until(ExpectedConditions.invisibilityOf(element));
} else if (KeyWord.contains("Alert")) {
    wait.until(ExpectedConditions.alertIsPresent());
}
kidney
  • 2,663
  • 17
  • 23

1 Answers1

0

The question already has an answer here: wait.until(ExpectedConditions) doesnt work any more in selenium basically telling you to add (or upgrade your existing) Google Guava dependency.

so1999
  • 117
  • 9