How to do Kendo UI MVVM UI automation test?

233 views Asked by At

My application is built using 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. All values are data bind.

When I look at the DOM tree, it will be

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

Currently, I am using Selenium Java to do automation testing by the way.

Thanks

1

There are 1 answers

4
NarendraR On BEST ANSWER

I hope this can be done using 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