Mobile Testing - Get the text and compare with the Expected text


#1

Hi ,

Can anyone help me with this?

I’m trying to get the text from the notification window and need to compare text with actual text.

def object = Mobile.getText(findTestObject(‘Object Repository/app_1/Username or password is incorrect’),0)

i tried get Text but it didn’t worked.

All i’m trying is to validate, if i get the username or password incorrect popup, it should compare the alert text with expected test.

Thanks a lot!!!

image.png


#2

Hi, I have the same issue as you, I get the notification dialog and I compare with the expected text but I don’t know how can I modify my script flow depending of the result of the comparison.

def Mensaje = Mobile.getText(findTestObject(‘Application/Inventario/Inventario - Mensaje’), 120)

def Verificacion = Mobile.verifyEqual(Mensaje, ‘Descarga de inventario finalizada correctamente’, FailureHandling.OPTIONAL)


#3

HI @afranco,

To branch your logic depending on the results of the comparison, you could do the following:

def Mensaje = Mobile.getText(findTestObject(‘Application/Inventario/Inventario - Mensaje’), 120)

def Verificacion = Mobile.verifyEqual(Mensaje, ‘Descarga de inventario finalizada correctamente’, FailureHandling.OPTIONAL)

if (Verificacion) {
// put your code here for what happens when the text matches
} 
else {
// put your code here for when the text doesn't match
}

Hope this helps,

Chris