Within my Java Selenium automation project, I am faced with the challenge of determining whether certain web elements contain pseudo elements or not.
I came across this question but found that the provided answer does not work as expected.
This solution seems more promising, although it involves locating an element which is different from my current scenario where I already have a web element and need to access its content.
As someone unfamiliar with JavaScript, my question is:
Given a Selenium WebElement object, how can I determine if it contains a pseudo element or not?
In the provided screenshot, one element shows a red dot representing the ::after
pseudo element, while others do not have this indicator.
Even using dev tools, I cannot visually identify the pseudo element in the HTML code provided; it appears similar to other elements without pseudo elements.
<div workspaceid="49426bdc-59fe-44ec-82ea-8f567407c04f" data-test-id="9B1qjz0kWcfO" class="list-item ListItem__ListItemComponent-bsdtqz-0 dgogUS RoleItem-sc-1n184cw-0 jyfJwu role-item"><p class="text-component Texts__GenericText-sc-1dju4ks-0 czkGYX name p">9B1qjz0kWcfO </p></div>