cobrateam/splinter — pull request #221 by jone (2013-03-10 17:40:15+00:00)
Title: Fix zope.testbrowser xpath lookups for links

When the result of ``find_by_xpath`` are links we should not re-search it only by the link text but by using the original xpath expression, otherwise the result might be wrong.
The result could also contain links with the *same text content* but which were not selected by the original xpath expression.

**Illustration of the bug:**

Given the HTML:
```html

Foo

Foo

```

when doing the query:
```python
self.browser.find_by_xpath('//div[@id="one"]/a')
```

the result did contain **both** links, because the have the same text contents - but we only did select the first one.

This is caused by the fact that ``find_by_xpath`` internally called ``find_link_by_text`` so that the result got properly wrapped into a ``ZopeTestBrowserLinkElement``.

This pull request fixes this bug by using ``_find_links_by_xpath`` with the original xpath expression instead of using ``find_link_by_text`` with a link-text-only expression.

This bug and its fix only affect the `zope.testbrowser` driver, other drivers such as `firefox` are working correctly in this situation already.