Skip to content

Chaining find_by_* seems to have no effect for xpath #1325

Open

Description

Problem:

I want to find a <td> from table, from given panel by using xpath and chaining find_by_* methods.

<div id="main">
<div class="panel">
<div class="heading">Table A</div>
<table>
<tr><td>Row 1</td><td>Value 1</td></tr>
</table>
</div>
<div class="panel">
<div class="heading">Table B</div>
<table>
<tr><td>Row 1</td><td>Value 1</td></tr>
</table>
</div></div>

panel = browser.find_by_xpath('//*[@id="main"]//div[@class="heading"][contains(normalize-space(), "Table A")]/following-sibling::table')
panel.find_by_tag("td") # return two elements from Table A
panel.find_by_xpath('//td') # will return all of td's

The reason why I'm using the xpath is that I want to find a cell with value next to some "label cell": //td[text()="Row 1"]/following-sibling::td[1] and in my code I have many of such row's with same names.

Expected behavior: it will return only td's from given panel.

Xpaths were tested also on http://xpather.com/ and it's working like expected.

Splinter version: 0.21.0, selenium: selenium/standalone-firefox:4.27

Browser setup like this:

browser = Browser(
            "remote",
            command_executor=SELENIUM_URL,
        )

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions