Reputation: 365
I'm looking for a way to have selenium webdriver wait until the text present in the element location I'm interested is NOT the string provided in the code below.
wait.until(ExpectedConditions.textToBePresentInElementLocated(By.xpath("//*[@id=\"order-details\"]/div[2]/div/dl/dd[1]/div"),"Completed successfully"));
I'm looking for a way where the "text to be present" is not "Completed successfully" so that the code can move forward and no longer wait
Upvotes: 1
Views: 2645
Reputation: 1838
You can try with ExpectedConditions - not
WebElement element = driver.findElement(By.xpath("//*[@id=\"order-details\"]/div[2]/div/dl/dd[1]/div"));
wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElement(element, "Completed successfully")));
Upvotes: 3