cancel
Showing results for 
Search instead for 
Did you mean: 

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
jerkins
Occasional Contributor

Re: Capturing Pseudo Elements

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"];

 

View solution in original post

3 REPLIES 3
TanyaYatskovska
Community Manager

Re: Capturing Pseudo Elements

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
jerkins
Occasional Contributor

Re: Capturing Pseudo Elements

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"];

 

View solution in original post

TanyaYatskovska
Community Manager

Re: Capturing Pseudo Elements

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

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements