如何做KendoUIMVVMUI自动化测试?

How to do Kendo UI MVVM UI automation test?

我的应用程序是使用 Kendo UI MVVM

构建的

当我尝试验证文本字段上的值时,它总是 returns 空字符串。这是因为应用程序正在使用 Kendo UI MVVM。所有值都是数据绑定。

当我看DOM树时,它会是

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

目前正在使用SeleniumJava顺便做自动化测试

谢谢

我希望这可以使用 JavascriptExecutor

来完成

使用此代码 -

    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);

因为它将return输入文本框的绑定值