I am creating an C# / Web Driver automation script that uses a Page Object Framework.
I would like to check certain dollar amounts on a page (premium and tax amounts) and verify that they are correct.
So, what I need to do is:
- Read in the premium and tax amount values
- Multiply the premium times the tax rate (which is stored in a separate class)
- Compare the result with the tax amount that is on the page using an assert statement
Below is the HTML from the page where the premium and tax amounts display.
<tr>
<td class="first-col">Premium:</td>
<td>$805.00</td>
<td> </td>
</tr>
<tr>
<td class="first-col">NJ State Tax:</td>
<td>$40.25</td>
<td> </td>
</tr>
I think I can locate the premium and state tax amounts using the following code
[FindsBy(How = How.XPath, Using = "//td[contains(text(),'Premium')]")]
public IWebElement premium { get; set; }
[FindsBy(How = How.XPath, Using = "//td[contains(text(),'State Tax')]")]
public IWebElement stateTax { get; set; }
However, I am unsure how to retrieve the values and perform the comparison.
Thanks in Advance