cobrateam / cobrateam/splinter

Chaining find_by_* seems to have no effect for xpath

Open
#1,325 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.7k
Forks
511
PR merge metrics
No merged PRs in 30d

Description

Problem:

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



Table A

Row 1Value 1



Table B

Row 1Value 1

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,
)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the chained find_by_xpath and find_by_tag calls from the issue with Splinter 0.21.0 and the stated Selenium setup. Trace the find_by_xpath entry point and compare descendant-scoped behavior with the leading // XPath; done means the XPath lookup returns only td elements from the selected panel while existing chaining behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.