简体   繁体   English

kendoMultiSelect: Java Selenium 如何 select 多个值?

[英]kendoMultiSelect: Java Selenium How to select multiple values?

I am trying to select multiple values from a kendoMultiSelect, I can't interact it with the Selenium methods.我正在尝试 select 来自 kendoMultiSelect 的多个值,我无法与 Selenium 方法进行交互。 I guess i need to use javascript execute function.我想我需要使用 javascript 执行 function。 What function should i use?我应该使用什么 function?

Yes javascript execute function will be your safest bet.是的 javascript 执行 function 将是您最安全的选择。

To use it in selenium you need to use the JavascriptExecutor interface of a driver.要在 selenium 中使用它,您需要使用驱动程序的JavascriptExecutor接口。

// Use your existing driver here
WebDriver driver= new FirefoxDriver();  
//JavascriptExecutor interface object by casting    
JavascriptExecutor js = (JavascriptExecutor)driver;
//executeAsyncScript() method with your JS      
js.executeAsyncScript("kendoMultiSelect.value(["Value 1","Value 2"]);");

The kendoMultiSelect variable is a JS variable that references your instance of the select. kendoMultiSelect变量是一个 JS 变量,它引用您的 select 实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Selenium 从多层下拉菜单中选择值 - How to select values from multiple layers of dropdown menu using Selenium 从API调用读取多选选项时,如何使用复选框预选KendoMultiselect的值 - How to Pre-select value for KendoMultiselect with checkboxes, when the multiselect options are read from an API call 如何用硒选择多个选择选项 - How to select multiple select options with selenium 如何在Selenium WebDriver中选择周范围值 - How to select Week Range values in selenium webdriver 如何选择多个行值 - how to select multiple row values Selenium自动化项目(Java)中的Javascript或如何不滚动 <select>清单 - Javascript in Selenium automation project(Java) or how to scroll not <select> list 如何从Java中通过ajax发送的select2获取多个值的列表? - How to get list of multiple values from select2 sent via ajax in Java? 如何根据键在flatlist中选择多个值 - How to select multiple values in flatlist based on there key 如何使用 JavaScript 设置多个选择的值 - How to set values of multiple select using JavaScript JQuery mobile - 如何设置多选的值? - JQuery mobile - how to set the values of a multiple select?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM