mardi 19 novembre 2019

How to select md-autocomplete option with Selenium or Selenide?

Here is my Java attempt, but what should I fix?

SelenideElement product = $(By.id("product"));
Assertions.assertEquals("Search product", product.attr("md-floating-label"));
product.find(By.tagName("input")).val("test");
SelenideElement span = product.find(By.tagName("span")); //this one and last lines does not work as expected
product.sendKeys(Keys.ARROW_DOWN);
product.pressEnter();

And HTML code

<md-autocomplete id="product" flex="85" md-selected-item="ctrl.orderItem.product" md-search-text="ctrl.productQuery" md-items="item in ctrl.findProduct(ctrl.productQuery)" md-item-text="item.name" md-delay="300" md-floating-label="Search product">
  <div layout="row" class="item" layout-align="start center">
    <span md-highlight-text="ctrl.productQuery"></span>
  </div>
</md-autocomplete>

Aucun commentaire:

Enregistrer un commentaire