(Using Webdriver / Java / Eclipse / TestNG)I want to work with a row item in a table. I'm going through the rows using a loop where my counter is declared and initialized as 'int row = 1'.The element declaration is as follows:--driver.findElement(By.xpath(".//*[@class='yui3-datatable-data']/tr[i]/td[contains(@class,'yui3-datatable-col-tmpt_name')]"))
Notice the "tr[i]" part of the xpath. If I use the integer varable 'i', I can't get the text. If I use actual integer, "tr[1]", I get the text just fine. Why?I tried changing the type to 'long', but it's not working.Thanks.
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/JqSrn_27Yi4J.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.
I believe Xpath search engine doesn't know when the "i" is a variable and when it is an actual i as in "yui". Use this tr[Myvar] in place off tr[i], and excute command MyXpath.replace(Myvar, i.tostring());
On Tue, Jun 19, 2012 at 12:10 PM, carina0110 <intern...@hotmail.com> wrote:
(Using Webdriver / Java / Eclipse / TestNG)I want to work with a row item in a table. I'm going through the rows using a loop where my counter is declared and initialized as 'int row = 1'.The element declaration is as follows:driver.findElement(By.xpath(".//*[@class='yui3-datatable-data']/tr[i]/td[contains(@class,'yui3-datatable-col-tmpt_name')]"))
Notice the "tr[i]" part of the xpath. If I use the integer varable 'i', I can't get the text. If I use actual integer, "tr[1]", I get the text just fine. Why?I tried changing the type to 'long', but it's not working.Thanks.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/JqSrn_27Yi4J.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.