I want to verify if the element is not visible in viewport then scroll to that element, do the click and if already visible in viewport then directly click on the element For this i am using
if (WebUI.verifyElementNotInViewport(TestObject obj, int timeout) == true) {
WebUI.scrollToElement(TestObject obj, 10)
WebUI.click(TestObject obj)
} else {
WebUI.click(TestObject obj)
}
Here else should be executed if the element is visible and in viewport, but I am getting error "is present but is visible in viewport" I tried the WebUI.verifyElementInViewport too, but with if the element is not in viewport then I am getting error "is present but is not visible in viewport"