- divya_agsrdkProfessional
- Posts : 93
Join date : 2013-01-17
program to provide total number of objects present / available on the page
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
@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
Re: program to provide total number of objects present / available on the page
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
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
- divya_agsrdkProfessional
- Posts : 93
Join date : 2013-01-17
Re: program to provide total number of objects present / available on the page
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?
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?
- kashyap_guruActive particpant
- Posts : 24
Join date : 2013-10-16
Age : 37
Location : India
Re: program to provide total number of objects present / available on the page
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.
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.
- To count the number of objects present on the page..
- How do i get the total number of rows and i have only the table id
- how to count number of items present in dropdown
- Verify text present when the text appears in more location in the page
- Using RegEx to match dynamic objects of a page with macth() function in IDE
Permissions in this forum:
You cannot reply to topics in this forum