【发布时间】:2016-05-23 21:08:34
【问题描述】:
我正在尝试设置一个简单的量角器测试,但由于某种原因我收到了错误:
NoSuchElementerror: No element found using locator: By(css selector, btn-primary3)
这是我正在运行的测试,
describe('Login to **: ', function () {
describe('When logging in with faulty data', function () {
it('Should show an error toast', function () {
browser.get('https://peter.dev.zen/#/inloggen');
element(by.model('credentials.Gebruikersnaam')).sendKeys('JonSnow');
element(by.model('credentials.Wachtwoord')).sendKeys('WinterIsComming');
element(by.css('btn-primary3')).click();
});
});
});
这是来自浏览器的html,
<fieldset>
<div class="text-input">
<label for="username"> Gebruikersnaam </label>
<input data-ng-model="credentials.Gebruikersnaam">
</div>
<div class="text-input>
<label for="password"> Wachtwoord </label>
<input data-ng-model="credentials.Wachtwoord">
</div>
<div class="buttons">
<a class="btn-primary3">Inloggen</a>
</div>
< /fieldset>
by.model 都可以正常工作,但是
element(by.css('btn-primary3')).click();
抛出错误,但类就在浏览器中。那么到底出了什么问题呢?
【问题讨论】:
标签: selenium protractor