I want to record a test, that enters an incorrect value into a field of a web application and then verifies that the font colour has changed to red (because the value is incorrect).
Is it possible to use Ranorex, to verify the red font colour?
Thanks!
Can Ranorex identify text colour on a website?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can Ranorex identify text colour on a website?
Hi Fergal,
Yes, this is possible. You need to get the specific style of the specific element in code. You can use a code similar to the following:
Markus
Yes, this is possible. You need to get the specific style of the specific element in code. You can use a code similar to the following:
var yourHTMLElement= repo.YourRootElement.YourHTMLElement; String color = yourHTMLElement.GetStyle("color"); // get the value of the specific css property Validate.AreEqual("red", color); Report.Info("Color: "+color);Regards,
Markus
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Can Ranorex identify text colour on a website?
Thanks for your reply Markus.
Is it possible to do this without writing a code module, i.e. through the recorder?
Is it possible to do this without writing a code module, i.e. through the recorder?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can Ranorex identify text colour on a website?
Hi Fergal,
It should be possible by using the Validate -> AttributeEqual action. As Match Name you can select color and as Match Value you can select the value: Please note that you also need to use "rgb(255, 0, 0)" in case the color CSS property is also set to "rgb(255, 0, 0)" instead of just red. So use the exact same value as used to define the color.
Regards,
Markus
It should be possible by using the Validate -> AttributeEqual action. As Match Name you can select color and as Match Value you can select the value: Please note that you also need to use "rgb(255, 0, 0)" in case the color CSS property is also set to "rgb(255, 0, 0)" instead of just red. So use the exact same value as used to define the color.
Regards,
Markus
You do not have the required permissions to view the files attached to this post.