简体   繁体   English

Kendo UI MVVM UI自动化测试如何做?

[英]How to do Kendo UI MVVM UI automation test?

My application is built using Kendo UI MVVM 我的应用程序是使用Kendo UI MVVM构建的

When I try to validate the value on a textfield, it always returns empty string. 当我尝试验证文本字段上的值时,它总是返回空字符串。 It is because the application is using Kendo UI MVVM. 这是因为该应用程序正在使用Kendo UI MVVM。 All values are data bind. 所有值都是数据绑定。

When I look at the DOM tree, it will be 当我看DOM树时,它将是

<input id="txtWorkPhone" class="k-textbox" data-bind="value: selectedParentContact.WorkPhone">

Currently, I am using Selenium Java to do automation testing by the way. 目前,我正在使用Selenium Java进行自动化测试。

Thanks 谢谢

I hope this can be done using JavascriptExecutor 我希望可以使用JavascriptExecutor完成

Use this code - 使用此代码-

    WebElement element = driver.findElement(By.id("txtWorkPhone"));

    JavascriptExecutor jse = (JavascriptExecutor)driver;
    String value = (String) jse.executeScript("return arguments[0].value", element) ;

    System.out.println("WorkPhone = "+value);

As It will return the bind value of input textbox 因为它将返回输入文本框的绑定值

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM