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,320 points
1,060 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,360 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,320 points
3,440 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,490 points
6,162 views
+1 vote
1 answer
0 votes
1 answer
0 votes
2 answers

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,500 points
13,449 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,013 views
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,910 points
7,127 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,808 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,360 points
7,673 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,360 points
14,705 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP