Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

program to provide total number of objects present / available on the page

View previous topic View next topic Go down

program to provide total number of objects present / available on the page

Post by divya_agsrdk on Wed Mar 20, 2013 3:40 pm

import com.thoughtworks.selenium.*;
@SuppressWarnings("deprecation")
public class objectcount extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.com/","*firefox");
}
public void testloginlogout(){
selenium.setSpeed("1000");
selenium.open("/mail/help/intl/en/logout.html#hl=en");
selenium.waitForPageToLoad("30000");
selenium.windowMaximize();
int num = selenium.getXpathCount("//p").intValue();
System.out.println("The number of option elements present are " +num);
}
}

Here
int num =selenium.getXpathCount("//p").intValue();

what is //p here?

hw to get that

divya_agsrdk
Professional
Professional

Posts : 93
Join date : 2013-01-17

Back to top Go down

Re: program to provide total number of objects present / available on the page

Post by Adviser on Thu Mar 21, 2013 8:29 pm

p is the one of the element in HTML known as paragraph where all elements reside into that tag.

this code search for every p tag in view source/Xpath on that basis it will give you number of elements exist on page whether it's image, link, button, text field , list or radio button.

Hope this will help You. best of luck.

bye

_________________
Spread Your Knowledge About Selenium Tool.

Administrator
Email: selenium.discussion.thread@live.com
Forum: http://seleniumforum.forumotion.net

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

Re: program to provide total number of objects present / available on the page

Post by divya_agsrdk on Wed Mar 27, 2013 1:32 pm

In gmail.com page, i m getting output as 9 objects for the above Program.
i think its not correct it has many objects.
instead of giving //p, how to find all the objects reside on the web page?

here getxpathcount ( ) ---- here wt parameter need to pass. wt it does?

divya_agsrdk
Professional
Professional

Posts : 93
Join date : 2013-01-17

Back to top Go down

Re: program to provide total number of objects present / available on the page

Post by kashyap_guru on Fri Oct 25, 2013 1:38 pm

Can't you identify objects based on "INPUT" tag?

All objects are initialized with INPUT tag only.

EX: storeXpathcount | //input | count

For image and a tag, you need to fire one more command and store it elsewhere.

kashyap_guru
Active particpant
Active particpant

Posts : 24
Join date : 2013-10-16
Age : 29
Location : India

Back to top Go down

Re: program to provide total number of objects present / available on the page

Post by Sponsored content Today at 9:01 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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