Hi All,
When I use WebUI.scrollToElement() unfortunately, due to the way the website is setup, it just happens to scroll the page so that the element sits behind a searchbox. Is there anyway to adjust how far it scrolls, or is there a better way to scroll to the element, so that it is visible.
I’ve tried adding this code:
WebDriver driver = DriverFactory.getWebDriver()
WebElement elem = driver.findElement(By.xpath(findTestObject(‘Page_Vacuum Cleaner Bags eSpares/input_14.99_submit_tablet’).findPropertyValue(
'xpath')))
WebUI.executeJavaScript(“arguments[0].scrollIntoView(true);”, elem)
But I end up getting the error:
Test Cases/New Test Case (1) FAILED because (of) (Stack trace: groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.executeJavaScript() is applicable for argument types: (java.lang.String, org.openqa.selenium.remote.RemoteWebElement) values: [arguments[0].scrollIntoView(true);, [[CChromeDriver: chrome on XP (1fa3a2c2ff8359180e81f6d761455998)] → xpath: id(“main-content”)/div[@class=“row”]/div[@class=“col-content”]/section[1]/ul[@class=“product-listing”]/li[@class=“product”]/div[@class=“buy”]/div[@class=“add-to-basket”]/form[1]/p[1]/input[@class=“btn btn-primary shoppingCartTrack”]]]
Possible solutions: executeJavaScript(java.lang.String, java.util.List), executeJavaScript(java.lang.String, java.util.List,