Ask a Question

Capturing Pseudo Elements

SOLVED
jerkins
Occasional Contributor

Capturing Pseudo Elements

Hi Team,

Is there a way to capture Pseudo elements using TestComplete?

I have '::after' in my code and I have to capture it to read the Computed Style of it. Now, how do I capture ::after ?

3 REPLIES 3
TanyaYatskovska
SmartBear Alumni (Retired)

Hi @jerkins,

 

Could you please give us more information? Images or some info about what you have inside :after will help.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



jerkins
Occasional Contributor

Hi Tanya,

Thanks for the reply. I figured out the solution myself which is pasted below.

//object is the node inside which pseudo element is available

 

var window = object.ownerDocument.defaultView;

var style = window.getComputedStyle(object,":after");

var computedStyle = style["content"];

 

TanyaYatskovska
SmartBear Alumni (Retired)

Hi @jerkins,

I'm happy to hear this!

Thanks for sharing the solution with us. Good luck in testing 🙂

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: