Verify Element In Viewport not working correctly

I am trying to use _WebUI.verifyElementInViewport _to check that two links are displayed.

I’m using the following code to looking for two links:

WebUI.verifyElementInViewport(findTestObject('a_mobilechargesupport.com'), 0, FailureHandling.CONTINUE_ON_FAILURE)
WebUI.verifyElementInViewport(findTestObject('a_Terms  Conditions'), 0, FailureHandling.CONTINUE_ON_FAILURE)

As you can see in the screenshot, neither link are visible in the viewport:

The test results come out as:

Link 1

Element position in viewport: x = 95, y = 514, width = 126, height = 13
Viewport infomation: width = 320, height = 454

The test fails, which is correct, the link is outside of the viewport.

Link 2

Element position in viewport: x = 186, y = 395, width = 95, height = 13
Viewport infomation: width = 320, height = 454

The test passes, which is incorrect. As you can see in the screenshot above, the link is not visible.

I can’t work out what’s going on!

VerifyElementInViewport.PNG

I’m perplexed…

Aren’t you testing a mobile app? And yet you are using WebUI keywords instead of Mobile keywords. Can you do that?

Didn’t realise there was a set of Mobile keywords, oops!

There is a ‘Verify Element Visible’ keyword in the mobile set but there aren’t keywords such as ‘Verify Text Present’. Is it still ok to use the WebUI version in these cases?

Well, I didn’t know it was possible to use Mobile keywords for web apps in the first place. :smiley:

I think it is ok to use WebUI version. I don’t mind. o:)

The mobile keywords aren’t working for me, I can’t even run the tests, I get an error “Mobile Test FAILED because (of) No driver found” :frowning:

Can’t help you there, I don’t use the Mobile keywords.

Don’t know if you noticed, but this is Web Testing section of the forum. There is also a Mobile section. I recommend posting a new question there.

Ah yes, good point. Thank you, I’ll head over there :slight_smile:

Right, spent a while looking into it, the mobile keywords appear to be for mobile environments that are physically attached to my test PC. I could be wrong as I’m still very new to Katalon.

What I’m trying to do is integrate with Browserstack so that I can test our landing pages on a number of different sized devices.

Its clear looking at the screenshots that the links are not visible in the viewport but the tests come back as passed :frowning: