Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

enter image description here

CSS locator :".header-GlobalAccountFlyout-link.display-block" returns 3 elements in a class. I need to get to the last one -"Create an Account". Does anybody know how to finish writing CSS to get there? Thank You.

1 Answer

0 votes
by (62.9k points)

Using Attribute Selectors we don't necessarily need the Class selectors here at all.

You have a few options:

1. If data-uid never changes:

[data-uid="eRDhfBAS"]

2. If the
href link never changes:

[href="/account/signup"]

3. If the
alt text never changes:

[alt="Create an Account"]

4. If the data-
tl-id never changes:

[data-tl-id="header-GlobalAccountFlyout-flyout-link-1"]

If there may be other elements with those same attributes and values, simply include your Class selectors as well. For example:

.header-GlobalAccountFlyout-link.display-block[href="/account/signup"]

Or you could combine some of the above attribute selectors...

[href="/account/signup"][alt="Create an Account"]

Browse Categories

...