Hello,
issue1: I want to wait for my script until the inner text of a given element has changed after an action. I tried the following scripts but it is not working. But it’s not waiting for the text to be changed.
pageObject variables
String pageNavigated = “//div[@id = ‘gatsby-announcer’]”
CustomKeywords.‘ciautils.ciaUtilities.addGlobalVariable’(‘pageNavigated’, pageNavigated)String pageNavigatedText =""
CustomKeywords.‘ciautils.ciaUtilities.addGlobalVariable’(‘pageNavigatedText’, pageNavigatedText)
Test script in test case
String text= “”
CustomKeywords.‘ciautils.ciaUtilities.navigateToPage’(GlobalVariable.careerButton)
boolean testResult = new ciaUtilities().waitVerifyPageNavigated(By.xpath(GlobalVariable.pageNavigated), text, 5)
CustomKeyword class
def static boolean waitVerifyPageNavigated(By locator, String checkText, int timeout){
WebDriverWait wait = new WebDriverWait(driver, timeout);
boolean boolValue
try{
if (wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementValue(locator, checkText)))) // here with the locator it gets some text and when compared with “” it is not waiting till it turned to “”
{
String text= driver.findElement(By.xpath(GlobalVariable.pageNavigated)).getText()
println(text)
GlobalVariable.pageNavigatedText == text
boolValue = true
}
}catch(e){
println(e)
boolValue =false
}
return boolValue
}