I have an element whose status (in text form) changes depending on a contextmenu associated with it.
Here is the element:
td id="A" name="status"> StatusStart </td>
Upon some action, this can become
td id="A" name="status"> StatusDone </td>
I want to wait for the text change to happen, using waitForCondition.
So far, i've tried:
selenium.waitForCondition("selenium.isElementPresent(\"//td[@name='status' and text()='StatusDone']\");", "10000");
but that doesn't work because the text is not part of the td element.
In JavaScript, i see something like:
function myfunc() {
window.getGlobal().addSelectGroup('status'); window.getGlobal().addSelectItem('status','StatusStart');
Please try to change xpath as follows.
//td[@name='status' and .//text()='StatusDone']
or
//td[@name='status' and contains(.//text(),'StatusDone')]
You say "that doesn't work because the text is not part of the td element". Which is odd, because the HTML you show says that the text is part of the TD element. And the waitForCondition()
you've tried is exactly the way to do it. My best guess is that the TD text is not exactly "StatusDone", but rather " StatusDone " (based on your HTML). The comparison will never match if so. There are obvious ways to fix that - add the spaces to the constant, or use contains(text(), 'StatusDone')
instead of the comparison.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With