Click here to Skip to main content
12,633,985 members (24,026 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: WaTiN
I'm developing a basic app that will perform a Google search based on a text field value and then open a web page based on a given Google result. I have this working, but only on the first result. I can't get access to the remaining results.

In firebug, I see this code for the first three listings

<h3 class="r">
<a class="l"  önmousedown="return rwt(this,'','','','2','AFQjCNGm_Xkvwld9e7TYNqWga_fksOOKlA','','0CDUQFjAB','','',event)" href="http://www.ht-llc.com/">
HealthTech Solutions
Group
</a>
</h3>

<h3 class="r">
<a class="l"  önmousedown="return rwt(this,'','','','2','AFQjCNGm_Xkvwld9e7TYNqWga_fksOOKlA','','0CDUQFjAB','','',event)" href="http://www.ht-llc.com/">
HealthTech Solutions
Group
</a>
</h3>

<h3 class="r">
<a class="l"  önmousedown="return rwt(this,'','','','4','AFQjCNF9v26pz2xQuVtIciioX883AVShsA','','0CEgQFjAD','','',event)" href="http://4hts.com/">
</h3>




Because they each have a class of "l", I have the code set up to look for the href value of the links with class of "l".

string resultStats = browser.Element(Find.ByClass("l")).GetAttributeValue("href").ToString();
                           
                            //Display URL in text box
                            txtResults.Text = "Opening URL: " + resultStats;


How can I modify this to pull back all the results, or at least let me select a specific one other than the first?
Posted 21-Jan-13 14:35pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100