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 bee
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');
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 bee
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');
Share
Improve this question
edited Sep 16, 2011 at 9:33
borrible
17.4k8 gold badges56 silver badges77 bronze badges
asked Sep 15, 2011 at 22:14
La LaLa La
551 silver badge4 bronze badges
4 Answers
Reset to default 4Please 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 parison 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 parison.
You could implement a repetitive storeText(css=td[name=status],var_name)
within a do-while (java) loop and break
once var_name="StatusDone"
Implicit wait?
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);