First 10 search results displayed from www.seleniumhq.org

0 votes

I wanted to search Selenium on google and wanted to display first 10 results from www.seleniumhq.org using Selenium RC

Below is my code:

int count = selenium.getXpathCount(

  "xpath=//a[contains(@href,'www.seleniumhq.org')]"

).intValue();

I’m getting wrong count for this i.e. correct count should be 2 since there is only 2 links which contains www.seleniumhq.org:
  1. www.seleniumhq.org
  2. www.seleniumhq.org/download/‎

Please help

Apr 13, 2018 in Selenium by Martin
• 4,220 points
122 views

1 answer to this question.

0 votes

Try this:

 int count= selenium.getXpathCount("xpath=//a[@onmousedown and @href and @data-cthref and contains(@href,'www.seleniumhq.org')]").intValue();
answered Apr 13, 2018 by Vardy
• 2,270 points

Related Questions In Selenium

0 votes
1 answer

How can I download the *.jar file from http:// seleniumhq.org using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,220 points
609 views
0 votes
1 answer

Downloading *.jar file from http:// seleniumhq.org using Selenium WebDriver

For Selenium Standalone Server: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); If downloading ...READ MORE

answered Apr 17, 2018 in Selenium by Shubham
• 13,310 points
451 views
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
976 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,131 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
873 views
0 votes
1 answer

Select an item from a dropdown list using Selenium WebDriver

Use this then it will work - new ...READ MORE

answered Apr 9, 2018 in Selenium by Vardy
• 2,270 points
2,643 views
0 votes
1 answer

How to run Selenium test case file from command line?

You’ll need Selenium RC for this: http://seleniumhq.org/download/  And the ...READ MORE

answered Apr 23, 2018 in Selenium by Vardy
• 2,270 points
3,242 views