Accessing tricky HTML attributes

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
User avatar
Posts: 67
Joined: Fri Oct 25, 2013 6:37 am
Location: Bangalore, India

Accessing tricky HTML attributes

Post by testautomator » Fri May 30, 2014 12:41 pm

I was facing some problems with accessing color codes for texts from our HTML 5 page.
The spy was not showing those attributes for the spantag since the devs did not code it in.
So, I got some help from Rx forum that we have to use getstyle method against the objects.

string strHexCode = spnMySpantag.getstyle("color");

This was very helpful. Just wanted to share.

Sometimes, you wont be able to see what you are looking for, spy cant show you the details unless the devs have coded it in. You might not be knowing the attribute name to give in getstyle. Use Chromes Dev tools. Open your 'HTML' page in chrome and right-click inspect-element. Chrome will take you to the code and on the right side you will different attributes for the object. I mean its like mother load for automation guys. Yeah we are talking..Enjoy
You can also do this with IE and Firefox.
You guys can give more inputs if you have any :) Please....