cancel
Showing results for 
Search instead for 
Did you mean: 

css class

Contributor

css class

In HTML page, I have the following code :

tr class="ClassName" align="center"

 With Xpath, I succed to access to this element, but I would like to have proprieties of class "ClassName".

An idea?

5 REPLIES 5
Moderator

Re: css class

You probably need something like this:

 

pageObj.contentDocument.styleSheets[index].cssRules[index]

More info:

How do you read CSS rule values with JavaScript?

document.StyleSheets

CSSStyleSheet object

CSSRule object


Helen Kosova
SmartBear Technical Writer
________________________

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

Re: css class

You could also use queryselector.

 

pageObject.queryselector("tr.ClassName")

Occasional Contributor

Re: css class

Try this

(By.ClassName("ClassName"));
Community Hero

Re: css class

@sanjayvaniya :
This is TestComplete but not Selenium forum and By will not work in TestComplete.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: css class

Hello,
You can use attr() function to retrive the value of the attribute. You can use it by just passing attribute name in the function and you will get a value as a result. Following is the example of attr() function.

E.x.

attr(class)