I want to verify if the text contained inside this paragraph is correct but I cannot get the text and make it into object. I used Verify Element Text but so far, I was just able to use it in the text inside the <strong> <strong> tag. I want to check the other text inside the <p> </p> too but can’t do so because there is a <strong> </strong> tag and a <br> inside. Here’s a snippet of what I was referring to.
I used chroPath to capture the element and make it into object. I stored the captured xpath into a label_companyPolicy_1 object. After doing so, I used the Get Text keyword but in the Script View, I stored the value of the Get Text into a variable name called companyPolicy in order for me to use this variable in the actualObject Field. However, after doing the steps above, still I wasn’t able to verify if the text inside the paragraph is equivalent to my expectedObject.
Oh. Okay. But you mentioned to use Get Text. Can I ask how would you do it on your end using the Get Text keyword? I guess we need to use Test Objects because that is going be the basis of what we are expecting? Correct me if I’m wrong.
Both getText and verifyElementText use element.getText(), so there should be no discrepancies.
Can you place getText from the element, print it out, and then use that text in verifyElementText to see if the result from getText is as expected and wether the result is usable in verifyElementText ? Something like this
String text = WebUI.getText(findTestObject('your Element'));
WebUI.verifyElementText(findTestObject('your element'), text);
As mentioned in the post above, there is a <br> after the words Work Week<br> A Work Week is composed of five (5) working days and two (2) Rest Days, except for Holidays.
Here’s the script:
String companyPolicy = WebUI.getText(findTestObject('View Shift/label_companyPolicy_1'), FailureHandling.STOP_ON_FAILURE)
WebUI.verifyElementText('View Shift/label_companyPolicy_1', 'Work Week A Work Week is composed of five (5) working days and two (2) Rest Days, except for Holidays.')