Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
useroforacle
Posts : 1
Join date : 2010-08-31

getXpathCount returning 0 Empty getXpathCount returning 0

Tue Aug 31, 2010 4:24 pm
This is my code for finding the row count of a table in a pop up window..I check if the table exists in the pop up window, and it returns me true as well as if a fetch a cell value from the table, then also i am getting a value..but when it try to fetch the row count or column count of the table, it returns value as 0..
What could be the problem..the table exists..but not able to fetch the rowcount..
for (int second = 0;; second++) {
if (second >= 90) fail("timeout");
try { if (selenium.isElementPresent("//html/body/form/div/table/tbody/tr[4]/td/div/div/div/table/tbody/tr[2]/td[2]")){
System.out.println("element present");
String tesstt = selenium.getText("//html/body/form/div/table/tbody/tr[4]/td/div/div/div/table/tbody/tr[2]/td[4]");
System.out.println("tesstt value==>"+tesstt);
if (selenium.isElementPresent("popupFrame"))
{
selenium.selectFrame("popupFrame");
System.out.println("Pop up frame selected");
http://Thread.sleep(15000);
int rowCount=selenium.getXpathCount("//html/body/form/div/table/tbody/tr[4]/td/div/div/div/table/tbody/tr").intValue();

System.out.println("rowCount===="+rowCount);}
else
System.out.println("Pop up frame not found");
break; }
}
catch (Exception e) {
System.out.println("Exception: element not present");
}
Thread.sleep(1000);
}
avatar
freesky
Amateur
Amateur
Posts : 72
Join date : 2011-04-13

getXpathCount returning 0 Empty Re: getXpathCount returning 0

Thu Aug 11, 2011 10:54 am
add Thread.sleep() before getXpathCount
avatar
mgharikrishnan
Active particpant
Active particpant
Posts : 10
Join date : 2011-06-20

getXpathCount returning 0 Empty Re: getXpathCount returning 0

Thu Aug 11, 2011 9:06 pm
Hi,

Try to something like this,

int rowCount = (Integer)selenium.getXpathCount("//table[@id='active-reg']/tbody/tr");
System.out.println("rowCount = "+rowCount);

~ Harri...
avatar
ashish_techie
Amateur
Amateur
Posts : 73
Join date : 2011-08-09

getXpathCount returning 0 Empty Smart solution for Webtables

Wed Aug 17, 2011 12:39 am
You can use following code

int rowcount=0

while(selenium.iselementPresent("//html/body/form/div/table/tbody/tr[4]/td/div/div/div/table/tbody/true](rowcount+1)+"])){

rowcount++
;
}


System.out.println("Total rows -- "+rowcount);

Regards
Ashish
For selenium training visit:
qtpselenium.com/samplevideos/selenium/seleniumvideos.php
Sponsored content

getXpathCount returning 0 Empty Re: getXpathCount returning 0

Back to top
Permissions in this forum:
You cannot reply to topics in this forum