ex)
<a class="sample" id="sample_id" href="../">sample text</a>
You can use either css or xpath to retrieve elements by specifying xpath, as shown below.
exist?(xpath:'//a[@class="sample"]')
exist?(css:'a[class="sample"]')#exist? (css: 'a.sample')
You may want to specify text at times like this, but is it possible to specify text using css selector?
#xpath
exist?(xpath:'//a[text()[contains(., "sample text")]]')
# css
...?
I don't think I can.
Similar items include jQuery's:contains selector, but the original CSS does not have these items (as of now).
© 2024 OneMinuteCode. All rights reserved.