79778765

Date: 2025-09-30 06:35:47
Score: 1
Natty:
Report link

import org.openqa.selenium.support.ui.WebDriverWait;

import org.openqa.selenium.support.ui.ExpectedConditions;

import java.time.Duration;

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));

List<WebElement> spanElement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[contains(text(),'Updated Text')]")));

System.out.println("spider: " + counts.get(0).getText());

System.out.println("amazon: " + counts.get(1).getText());

output :

spider: 645

amazon: 27836

You can also use other ExpectedConditions based on the action you need to perform:

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Supriya Mandke