isSelected 返回 false 并且 isChecked 显示编译错误 [英] isSelected returns false and isChecked shows compilation error

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

问题描述

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

在上面的代码中isSelected返回false,如果我用isChecked替换它,它会显示错误为在ElementFinder上找不到属性'ischecked'"

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

我该如何克服这个问题

推荐答案

Protractor 中没有什么叫做 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天全站免登陆