【发布时间】:2014-01-20 22:24:42
【问题描述】:
我的测试:
it('should allow login', function() {
browser.get('index.html');
$('#username').sendKeys('administrator');
$('#password').sendKeys('password');
$('#login').click();
var logout = $('#logout');
expect($p.isElementPresent(logout)).to.eventually.be.true;
});
但这会出错:
Error: Unsupported locator strategy: click
at Error (<anonymous>)
at Function.webdriver.Locator.createFromObj (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/locators.js:97:9)
at Function.webdriver.Locator.checkLocator (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/locators.js:111:33)
at webdriver.WebDriver.findElements (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:805:31)
at webdriver.WebDriver.isElementPresent (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:787:29)
at Protractor.isElementPresent (/usr/local/lib/node_modules/protractor/lib/protractor.js:476:22)
at /Users/pschuegr/wt/client/e2e/login_test.js:26:15
奇怪的是,它指向的是 isElementPresent 线,而不是点击的那条线。我对 webdriver 很陌生,如果我错过了一些明显的东西,我深表歉意。我正在使用 mocha 框架(这意味着量角器的金丝雀版本)运行,fwiw。
任何想法表示赞赏。
【问题讨论】:
-
什么是 $p,它来自哪里?
-
$p 是量角器实例(即 ptor)
-
现在
$p和ptor已被browser有效取代
标签: angularjs mocha.js protractor