I am currently attempting to locate a specific element within another element.
The structure of my HTML looks like this:
<div>
<label>test</label>
<div>
<a>testlink</a>
<input type='text'></input>
<textarea></textarea>
</div>
</div>
Initially, I have the label based on its text and now I am attempting to access the input under its sibling. However, there are cases where an additional layer exists under the sibling div like so:
<div>
<label>test</label>
<div>
<div>
<a>testlink</a>
<input type='text'></input>
<textarea></textarea>
</div>
</div>
</div>
This is what I have attempted thus far:
const labelElement = await Selector('label').withText('test')
const inputField = labelElement.sibling('div').find('input').withAttribute('type', 'text')
The issue I am encountering is that I am retrieving all input fields on the page, rather than just the one I need. It seems that find function retrieves all matches.
Is there a way to specifically target the required input field?