单击跨度不带表格单元格不起作用-量角器/打字稿

时间:2019-11-26 05:14:28

标签: typescript selenium protractor

单击“跨越网格的跨距元素”不起作用。我尝试了操作,并在下面的代码下都无法正常工作。请指教。          

async SaveorCancelRow() {
    var table = this.component;
    var tbody = table.element(by.xpath(".//tbody"));
    var trs = tbody.all(by.tagName("tr")).get(1);

    //Click Save tr[@class='SearchResultItemView customGridHighlight']//td[3]
    await trs
      .element(by.xpath('.//td[3]//span[contains(@class, "save")]'))
      .click()
      .then(function() {
        browser.sleep(5000);
      });
  }
}

1 个答案:

答案 0 :(得分:0)

尝试下面的简化代码。

async SaveorCancelRow() {
    await this.component
             .element(by.css('tbody > tr.SearchResultItemView > td > span.save'))
             .click()

    return await browser.sleep(5000);
  }
}