I want to verify footer information of my site using verify command in TestStudio ide. Let say my footer information is like "Demo version 1.20.01 Copyright 2015".
I have a version number stored in global variable in Utility class.
How can I use Regex to verify this in one statement with global variable ?
5 Answers, 1 is accepted
Thanks for the reply. I resolved this by created Coded Step instead of using regular step and it worked as I wanted.
Could you please help me with the coded step for the verification of text content using regular expression
The DOM will look like this
<div id="ID123" style="">
AutomationTest: Verify Text Message1. <br><br>
<b>Verify Text Message2</b>
<br>Verify Text Message3
Verify Text Message4.
<b>Verify Text Message5</b>
<li>Verify Text Message6</li>
<b>Verify Text Message7</b>
<ul class="bullet"><li>Verify Text Message8 Tagen</li>
Need to verify the content using RegEx "AutomationTest: Verify Text Message1."
This content will be changing dynamically, so i tried using with coded test step, however i'm getting the error as "Object reference not set to an instance of an object."
HtmlDiv topdiv = Find.ByXPath<HtmlDiv>("//div[@id='ID123']/text()");
topdiv.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.RegEx,"AutomationTest: Verify Text Message1.");
Could you please advice on this scenario.
I hosted the DOM tree locally and ran the code, which you have shared. The error that you have experienced is caused by the HtmlDiv's find expression, which does not return a valid element. I did some changes to the XPath and the rest of your code works. Please check the changes I did and apply them to your test project.
I hope the above example will help you automate this scenario.