How to handle the slider to make the element visible

How to handle the slider to make the element visible

More information would be more helpful…

What do you mean by “the slider”?
There are several things that slides in the world, so I do not see what you mean?
Please take a screenshot of “the slider” and show it to us.

After I tried, the drop-down box here needs to be scrolled, otherwise it cannot be clicked

Unfortunately, you haven’t shown us enough HTML to get the whole code, however, you can get to click on the tenth item in the list by doing something like below. Since I cannot see what tag is “below” the <li> tag, you will have to fill in/change that part.

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement

WebDriver driver = DriverFactory.getWebDriver()

List<WebElement> items = driver.findElements(By.xpath('//li[@class="el-select-dropdown__item"]/span'))

println('No. of items are: ' + items.size())
WebUI.comment("No. of items are: ${items.size()}")


Because the order is changed, this time it is the tenth, but the next time I can’t determine it. I used js to process when I used selenium, execute_script(“arguments[0].scrollIntoView()”,elem)
Let the element slide to be visible, I want to ask if there is a similar method in studio

I tried the following methods, but failed, do you know the reason

    WebUI.executeJavaScript('arguments[0].scrollIntoView()', [findTestObject('Page_IO Controller  WAN/Design/Network_Design/Link_Setting/text_LinkSetting_RouteDomain_Choose', 
                [('route_domain_name') : findTestData('Design/Network_Design/Link_Setting/add_link_data').getValue(2, 

KS should understand Selenium code.

Instead of clicking on the tenth item, then you will have to cycle through the list and compare your choice:

    def choice = findTestData('Design/Network_Design/Link_Setting/add_link_data').getValue(2, index)
	for (int icnt = 0; icnt < items.size(); icnt++) {
		if (items.get(icnt).getText() == choice)

1 Like

I discovered that there is a corresponding command in web.UI, WebUI.scrollToElement

     WebUI.scrollToElement(findTestObject('Page_IO Controller WAN/Design/Network_Design/Link_Setting/text_LinkSetting_RouteDomain_Choose',
             [('route_domain_name'): findTestData('Design/Network_Design/Link_Setting/add_link_data').getValue(2, index)]), 2)
1 Like