Get Text from page and Verify Text to another page

Hi All

I want to get the text total price from the cart menu then I want to verify text the total price on the invoice menu.

can someone help me with how I write the test case?

1 Like

You need to get and “store” the total price from the cart menu, probably like:

totalPriceCartMenu = WebUI.getAttribute(findTestObject('pathway1'), "value")

and then get and “store” the total price on the invoice menu

totalPriceInvoiceMenu = WebUI.getAttribute(findTestObject('pathway2'), "value")

and lastly, compare them.

WebUI.verifyMatch(totalPriceCartMenu, totalPriceInvoiceMenu, false)

or

assert totalPriceCartMenu == totalPriceInvoiceMenu

I assume you know when to use “getAttribute()” or “getText()” so I just gave an example of one of them to move forward.

Note: If you move from one Test Case to another within a Test Suite to get the two values, then you will have to use Global Variables. Otherwise, the same idea as above.

3 Likes

Thanks for the help, it worked. :+1:

1 Like

Thank you @grylion54 so much!!!