Condition fails TC in Chrome but not in firefox


I’m wondering why my TC is failing only on Chrome, but not in other browsers.

int helper = 1
		boolean test = false
		while (test == false) {
			if (WebUI.verifyElementVisibleInViewport(findTestObject('Variable product page/randomItem', [('randID') : helper]), 1, FailureHandling.OPTIONAL)) {
				helper += 1
			} else {
				test = true
				helper -= 1


Goal is to check how many different certain elements there is on that web page by going them all through and going to else statement when reached the element that is not visible (or present, tried that too)

On firefox that works just fine, but everytime on Chrome TC fails. It goes through the TC, but in the end it marks it failed.

It looks to me that you need to wait for the page to be loaded:

And then, wait for the element you’re trying to access to be (at least) visible:

Thanks for the reply. That is actually not the case. Page is loaded and in the example that element [9] is found correctly and if goes to if part and in element [10] as in picture in my earlier comment, is not and should not be visible and case should go to else part of the condition and it goes, but it still marks the case failed which it should not do.

After all it appeared that I had in another location of the test failure handling continue and not optional so the tc failed to that.