【发布时间】:2018-07-09 00:10:08
【问题描述】:
根据 webdriver 文档With the $ and $$ functions WebdriverIO provides useful shortcuts which can also be chained in order to move deeper in the DOM tree without using complex xPath selectors.
但在这里我正在尝试使用 web 驱动程序和 chai 为我的 reactjs 和 flowjs 应用程序编写 cucumber 测试,
我有这样的用户界面,我需要使用按钮文本/值来测试所有按钮的存在。这是设计
这是我尝试过的
const links = $$('.button').filter(function(link) {
return link.isVisible();
});
const button1_value = links[0].getText();
const button2_value = links[1].getText();
expect(button1_value).to.equal('button1');
expect(button2_value).to.equal('button2');
有没有其他方法可以获取按钮列表并进行测试。
我是否必须导入 $ 和 $$ 才能在 js 文件中使用。
【问题讨论】:
-
您确定您的 WebdriverIO 安装正确吗?
标签: javascript selenium selenium-webdriver webdriver cucumber