- Issue created by @murz
- Merge request !114Issue #3480281: Create a Nightwatch function to search elements by nested selectors → (Open) created by murz
Found out that Nightwatch doesn't provide a built-in API to search elements by selector in the results of another selector.
Let's imagine that we have a page with a list of product cards, and want to check the content of a card number 3:
- h2 title value
- the price value
- the action button text
Yes, we can invent a complex CSS selector to choose those elements, but CSS doesn't provide good ways to choose elements from multiple matches by their index.
So, it's much easir to make this selection as multistep:
- First, find the card element.
- Then, find needed elements inside this card html code.
But Nightwatch API provides only the way to search elements in the whole HTML page, not in the sub-secton of it, starting from a specific element.
So, would be good to implement this feature in a custom function them.
Create the thFindNested(array of selectors)
Nightwatch command that will do multiple nested searches of selectors and return the last matching element.
Active
1.5
Code