XPathManupulator parentesis handling bug
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.6k
- Forks
- 286
- PR merge metrics
- No merged PRs in 30d
Description
Consider following input:
- prefix:
descendant-or-self::*[@id = 'checkbox-with-preceding-label'] - xpath:
(//label[@for = 'checkbox-with-preceding-label'])[1]
I expect result to be descendant-or-self::*[@id = 'checkbox-with-preceding-label']/(//label[@for = 'checkbox-with-preceding-label'])[1] (both prefix and xpath combined using /).
In reality this produced this xpath: (descendant-or-self::*[@id = 'checkbox-with-preceding-label']//label[@for = 'checkbox-with-preceding-label'])[1] (the prefix is injected into parenthesis and produces xpath that doesn't match what's expected).
I'm using parentheses in xpath to specify which of found elements I want to get. It as well can be 5th element, so using find instead of findAll method isn't a viable solution.
P.S.
I'm trying to find matching label by for attribute across the document, but I start with checkbox xpath, that I can't change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the XPathManupulator implementation and reproduce the issue with the prefix and parenthesized XPath shown in the report. Compare the generated XPath with the expected slash-combined form; done means parenthesized element selection preserves the intended scope and existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100