How to locate search links in google in Selenium for testing <p>I am trying to search Google for Selenium, then run down the list of links by clicking each one, printing the page title, then navigating back.</p> <pre><code>List&lt;WebElement&gt; linkElements = driver.findElements( **&lt;insert code here&gt;** ); for(WebElement elem: linkElements) { String text = elem.getText(); driver.findElement(By.linkText(text)).click(); System.out.println("Title of link\t:\t" + driver.getTitle()); driver.navigate().back(); } </code></pre> <p>To find the elements, I have tried By.tagName("a") which doesn't work because it gets ALL the links, not just the search ones. Using Firebug, I see that each search link has a class of r used on the header h3, and the a tag nested inside it.</p> <p>See the following:</p> <pre><code>&lt;h3 class="r"&gt; &lt;a href="/url sa=t&amp;amp;rct=j&amp;amp;q=selenium&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CC8QFjAA&amp;amp;url=http%3A%2F%2Fseleniumhq.org%2F&amp;amp;ei=y4eNUYiIGuS7iwL-r4DADA&amp;amp;usg=AFQjCNHCelhj_BWssRX2H0HZCcPqhgBrRg&amp;amp;sig2=WBhmm65gCH7RQxIv9vgrug&amp;amp;bvm=bv.46340616,d.cGE" onmousedown="return rwt(this,'','','','1','AFQjCNHCelhj_BWssRX2H0HZCcPqhgBrRg','WBhmm65gCH7RQxIv9vgrug','0CC8QFjAA','','',event)"&gt;&lt;em&gt;Selenium&lt;/em&gt; - Web Browser Automation &lt;/a&gt;&lt;/h3&gt; </code></pre> <p>What code can I insert to make this work?</p>