My HTML document contains the following element:
HTML:
<hmtl>
<head>
<style>
label::after {
content: " *"
}
</style>
</head>
<body>
<label> I'm mandatory</label>
</body>
</hmtl>
When rendered in a web browser, it displays as:
I'm mandatory *
Query Selector
>getComputedStyle(document.querySelector('label')).content
<"normal"
However, instead of seeing "*", I get the result "normal
". This confuses me as to where this is coming from. Is my approach correct for testing the content of the ::after
CSS selector?
I'm attempting to verify if there is a "*" after the label, yet unable to extract the value of the "content" property accurately. Once I am able to locate it using the browser DOM API, I intend to test this functionality in Protractor.
Update
After finding guidance on - Selenium WebDriver get text from CSS property "content" on a ::before pseudo element, I still question how to conduct this test using Protractor.