Hi,
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 ?
Thanks,
Chandresh Parmar
5 Answers, 1 is accepted
This request is not Test Studio related, you can learn how to build your regex using this website.
Thank you for your understanding.
Regards,
Ivaylo
Telerik
Hello Ivaylo,
Thanks for the reply. I resolved this by created Coded Step instead of using regular step and it worked as I wanted.
Thanks,
Chandresh
Glad to hear you were able to resolve this.
Regards,
Ivaylo
Telerik
Hi
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
<br>
<br>
<b>
Verify Text Message4.
<br>
<br>
<b>Verify Text Message5</b>
<ul class="bullet">
<li>Verify Text Message6</li>
</ul>
<b>Verify Text Message7</b>
<ul class="bullet"><li>Verify Text Message8 Tagen</li>
</ul>
</div>
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()[1]");
topdiv.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.RegEx,"AutomationTest: Verify Text Message1.");
Could you please advice on this scenario.
Thank you
Subhash
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.
HtmlDiv topdiv = Find.ByXPath<
HtmlDiv
>("//div[@id='ID123']");
I hope the above example will help you automate this scenario.
Regards,
Plamen Mitrev
Progress Telerik