- manukvk
- Posts : 1
Join date : 2010-08-11
how to capture time/number of results in google results page
Wed Aug 11, 2010 6:39 pm
I got a small trouble while using selenium in IDE 1.0.5 .I need to capture a value and retrieve back for example in google page , after results are displayed i need to capture value of time it took.Iam enclosing the code used by me to do it.when i run this i got a NULL value .Please help me out.
public void testtest() {
selenium.open("/firefox?client=firefox-a&rls=org.mozilla:en-US:official");
selenium.type("sf", "SACHIN");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
String i = selenium.getValue("//div[@id="resultStats"]");
Reporter.log(i);
}
public void testtest() {
selenium.open("/firefox?client=firefox-a&rls=org.mozilla:en-US:official");
selenium.type("sf", "SACHIN");
selenium.click("btnG");
selenium.waitForPageToLoad("30000");
String i = selenium.getValue("//div[@id="resultStats"]");
Reporter.log(i);
}
Re: how to capture time/number of results in google results page
Sun Aug 15, 2010 11:49 am
hi,
Try this code
public void testUntitled 2() throws Exception
{
selenium.open("http://www.google.co.in/");
selenium.type("q", "selenium");
selenium.click("btnG");
verifyTrue(selenium.isElementPresent("resultStats"));
String var2 = selenium.getText("resultStats");
selenium.type("q", var2);
}
}
Best of luck
Try this code
public void testUntitled 2() throws Exception
{
selenium.open("http://www.google.co.in/");
selenium.type("q", "selenium");
selenium.click("btnG");
verifyTrue(selenium.isElementPresent("resultStats"));
String var2 = selenium.getText("resultStats");
selenium.type("q", var2);
}
}
Best of luck
- uma maheswariActive particpant
- Posts : 12
Join date : 2010-10-19
Re: how to capture time/number of results in google results page
Fri Oct 22, 2010 8:20 pm
Hai adviser,
-I tryed the coding what you given which is above,but for me not working.
-For me
package ss;
import java.util.regex.Pattern;
import com.thoughtworks.selenium.*;
public class form extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.co.in/", "*chrome");
}
public void testform() throws Exception
{
selenium.open("/");
selenium.type("q", "selenium");
selenium.click("btnG");
verifyTrue(selenium.isElementPresent("//ol[@id='rso']/li[8]/h3/a/em"));
//verifyTrue(selenium.isElementPresent("SELENIUM"));
String var2 = selenium.getText("//ol[@id='rso']/li[8]/h3/a/em");
selenium.type("q", var2);
}
}
while using this,how will i capture the time?error occuring like
"com.thoughtworks.selenium.SeleniumException: ERROR: Element //ol[@id='rso']/li[8]/h3/a/em not found
Please help me.
Thanks in advance
Regards
uma
-I tryed the coding what you given which is above,but for me not working.
-For me
package ss;
import java.util.regex.Pattern;
import com.thoughtworks.selenium.*;
public class form extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.google.co.in/", "*chrome");
}
public void testform() throws Exception
{
selenium.open("/");
selenium.type("q", "selenium");
selenium.click("btnG");
verifyTrue(selenium.isElementPresent("//ol[@id='rso']/li[8]/h3/a/em"));
//verifyTrue(selenium.isElementPresent("SELENIUM"));
String var2 = selenium.getText("//ol[@id='rso']/li[8]/h3/a/em");
selenium.type("q", var2);
}
}
while using this,how will i capture the time?error occuring like
"com.thoughtworks.selenium.SeleniumException: ERROR: Element //ol[@id='rso']/li[8]/h3/a/em not found
Please help me.
Thanks in advance
Regards
uma
- PriyankaRegular Participant
- Posts : 27
Join date : 2010-10-04
Re: how to capture time/number of results in google results page
Tue Oct 26, 2010 11:57 am
Hi Uma,
Please insert a command "selenium.WaitForPageToLoad("30000");" before verifying the element present. Like below
selenium.Click("btnG");
selenium.WaitForPageToLoad("30000");
verifyTrue(selenium.isElementPresent("//ol[@id='rso']/li[8]/h3/a/em"));
Please try it...
Please insert a command "selenium.WaitForPageToLoad("30000");" before verifying the element present. Like below
selenium.Click("btnG");
selenium.WaitForPageToLoad("30000");
verifyTrue(selenium.isElementPresent("//ol[@id='rso']/li[8]/h3/a/em"));
Please try it...
- ash_tha
- Posts : 5
Join date : 2010-11-22
Re: how to capture time/number of results in google results page
Mon Nov 22, 2010 6:01 pm
I am Ashish and I have over 5 years of exp in automation testing and have worked on various automation as well as load testing tools.
I teach selenium and QTP online as part time stuff.
- First class is trial class.
- Video of class will be provided
- 1 hour per day. 48 days course. 5 days a week
- Small batch size of 3-4 students max
- English will be the course language
- Course fee is INR 12000 (USD265$). Half the fee has to be paid after trial class. Half after IDE is over.
You can go to following link for details and registration:
http://www.sejsoft.com/training/java_training.php
OR
You can write a mail at automation@sejsoft.com or itsthakur@gmail.com
- To count the number of objects present on the page..
- How to launch a number of IE browser instances at time when using Selenium server.
- program to provide total number of objects present / available on the page
- Showing Error in google page using IDE
- Selenium RC code for testing the last page of Google Search
Permissions in this forum:
You cannot reply to topics in this forum