isSelected返回false和展示器isChecked编译错误 [英] isSelected returns false and isChecked shows compilation error

查看:255
本文介绍了isSelected返回false和展示器isChecked编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

let checkBoxXpath = accessPolicyPage.listCheckBoxXpathS + i + accessPolicyPage.listCheckBoxXpathE;
//element(by.xpath(checkBoxXpath)).click();
expect(element(by.xpath(checkBoxXpath)).isSelected()).toBeTruthy();

在上面的code isSelected返回false,如果我被替换器isChecked它,它会显示错误的财产器isChecked不ElementFinder找到

in the above code isSelected returns false and if I replace it by isChecked, it shows error as "property 'ischecked' not found on ElementFinder"

我怎样才能克服这种

推荐答案

有什么在叫量角器器isChecked。您可以通过使用isSelected做到这一点。

There is nothing called isChecked in Protractor. You can do this by using isSelected.

webdriver.WebElement.prototype.isSelected = function() {
  return this.schedule_(
      new webdriver.Command(webdriver.CommandName.IS_ELEMENT_SELECTED),
      'WebElement.isSelected()');
};

这以了解更多信息。希望这可以帮助。 :)

Refer this to more information. Hope this helps. :)

这篇关于isSelected返回false和展示器isChecked编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆