Waiting until text to be present in element is NOT the string provided

匆匆过客 提交于 2021-01-29 05:41:52

问题


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


回答1:


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")));


来源:https://stackoverflow.com/questions/57101845/waiting-until-text-to-be-present-in-element-is-not-the-string-provided

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!