Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

browser.find_link_by_partial_text() doesn't always work #230

Open
SEJeff opened this Issue Apr 23, 2013 · 7 comments

Comments

Projects
None yet
4 participants

SEJeff commented Apr 23, 2013

browser is a splinter.Browser() instance with the firefox driver.

>>> browser.find_link_by_partial_text("admin").text
u'admin DEV'
>>> browser.find_link_by_partial_text("admin DEV")
[]

The html to reproduce this issue

<a class="brand" href="/">
<span>admin</span> <span style="display: inline;" class="env-DEV">DEV</span>
</a>
Member

douglascamata commented Apr 23, 2013

Please, update the html to include the a tag too.

SEJeff commented Apr 23, 2013

Sorry it is. I left a bit of it out. Updated the original html

Member

douglascamata commented Apr 23, 2013

Awkward, Splinter would try to find that using the xpath selector //a[contains(text(), "admin DEV")]. I'll check if another libs with xpath selectors have the same issue.

Member

douglascamata commented Apr 23, 2013

Can you test that with Chrome and/or zope.testbrowser too, please?

Contributor

kedder commented Jan 23, 2014

find_link_by_partial_text() will also not find links with line-breaks, e.g.:

<a href="add-employee.html">
  <i class="fa fa-fw fa-user"></i>
  &nbsp;
  Add Employee
</a>

If you change the xpath to this one, find_link_by_partial_text() will work (as I expect at least): //a[contains(., "Add Employee")]

Contributor

kedder commented Jan 23, 2014

The current (wrong) behavior is the same with zope.testbrowser and phantomjs.

kedder added a commit to kedder/splinter that referenced this issue Jan 23, 2014

More robust find_link_by_partial_text()
Make find_link_by_partial_text() be able to find links with
complex markup inside <a> tag, ignoring extra spaces and newlines
between words.

Fixes #230.

kedder added a commit to kedder/splinter that referenced this issue Jan 23, 2014

More robust find_link_by_partial_text()
Make find_link_by_partial_text() be able to find links with
complex markup inside <a> tag, ignoring extra spaces and newlines
between words.

Fixes #230.
Owner

andrewsmedina commented Dec 12, 2015

This problem still happens. Reopening.

@andrewsmedina andrewsmedina reopened this Dec 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment