Answer the question
In order to leave comments, you need to log in
How will XPATH expressions be rewritten in CSS?
I have XPATH expressions:
1. '//header//ul[@id="nav"]/li[4]/a'.
How will it look like as a CSS locator?
This expression looks for a header element, and when found it looks for a ul with an id attribute whose id is "nav". After finding the ul in its children, the 4th li is searched (numbered from 1, not 0). Finally, all a-tags are extracted. I note that header, ul are not searched from the root. There can be multiple elements between header and root. There can also be multiple elements between ul and header.
2.
xpath = '//table[@align="center" and @border="0" and class="regt"]//ul//li[5]/p'
Find a table tag with 3 attributes set and the condition is met: align is equal to "center" AND border is equal to "0" And class is "regt".
For me, so far, the difficulty is:
1. Indication of the 4th li-tag.
2. How to set conditions in CSS locators?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question