0

I wonder if someone can help, as I can't work this out, I am wanting to use WebDriver Sampler in JMeter and am getting stuck working out a WaitForText.

I want to wait for "Complete" in the element //tr[6]/td[2]/strong, this is what I have, but it isn't working and I'm not sure why, hope someone can help:

wait.until("Complete".presenceOfElementLocated(By.xpath("//tr[6]/td[2]/strong")).getText())

1 Answer 1

2

I don't know what programming language you use, the below answer assumes default WebDriver Sampler language which is JavaScript.

You should implement your own custom Function like

var wait = new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 10)
WaitForText = function() {
    var text = WDS.browser.findElement(org.openqa.selenium.By.xpath('//tr[6]/td[2]/strong')).getText()    
    return text.equals('Complete')
}
wait.until(new com.google.common.base.Function(WaitForText))

For more WebDriver Sampler related tips and tricks refer to The WebDriver Sampler: Your Top 10 Questions Answered guide

1
  • Thank you so much for this, you have really helped me :)
    – Karl
    Dec 1, 2016 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.