Verify text submit button

Hi guys, I am struggling to verify the text of a submit button and I wondered whether someone can provide some guidance?

Below is the html from the website (it can also be found at https://getacard.getmethere.com/home.faces):

I am using CSS for my object selection method and this equates to:

#orderNowForm\3a orderNowButton

My scripting is as follows:

WebUI.verifyElementText(findTestObject(‘Button_Create_Account’), ‘Create your account now’)

However, when running this test case, Katalon returns the following error:

Test Case FAILED because (of) Verify element text of test object ‘Object Repository/Button_Create_Account’ FAILED. (Root cause: Actual text ‘’ and expected text ‘Create your account now’ of test object ‘Object Repository/Button_Create_Account’ are NOT matched.

Could someone advise why this may not be working and perhaps suggest an alternative method (if applicable)?

Why not use xpath tied to the id for your object selection? //div[@id = ‘orderNowForm:orderNowButton’]

1 Like

How about this:

WebUI.verifyEqual(
    WebUI.getAttribute(findTestObject('Button_Create_Account'), 'value'),
    'Create your account now')

‘Create your account now’ is not a element text; it is contained in the value attribute of the input element. So you need to use WebUI.getAttribute() to select the value rather than using WebUI.verifyElementText().

2 Likes

@4280-kazurayam to let you know that your suggestion worked. Thanks for your support.