我的測試失敗:簡單量角器測試與不支持的定位策略
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相當陌生,所以如果我錯過了某些明顯的道歉,我很抱歉。我正在使用摩卡框架(這意味着量角器的金絲雀版本),fwiw。
任何想法讚賞。
什麼是$ p,它來自哪裏? – wlingke
$ p是量角器實例(即ptor) – pschuegr
現在'$ p'和'ptor'已被'browser'有效替換 –