嗨,我的问题是,我不断收到消息,“量角器不可见”元素。我只是想让它找到输入字段并将它发送给它,它不起作用。整个项目网站在angualrJS完成我甚至有browser.ignoreSynchronization = true;组。有什么建议么。量角器元素不可见输入字段
HTML代码
input parse-search-query="" type="text" tabindex="1" name="search_query" autocomplete="off" placeholder="Search by City ST, Zip, or Address" data-ng-model="searchQueryFieldCtrl.searchFormController.searchParams.search_query" data-ng-change="searchQueryFieldCtrl.searchFormController.clearErrors()" data-focus-on="focusQuery || form.search_query.$error" data-uib-typeahead="suggestion as suggestion.label for suggestion in searchQueryFieldCtrl.getSuggestions($viewValue)" data-typeahead-focus-first="false" data-typeahead-min-length="0" data-typeahead-wait-ms="300" data-typeahead-on-select="searchQueryFieldCtrl.setSearch($item)" class="ng-pristine ng-untouched ng-valid ng-scope" aria-autocomplete="list" aria-expanded="false" aria-owns="typeahead-69-869">
spec.js
describe('New stack hompage test', function() {
it('should test search form', function() {
browser.ignoreSynchronization = true;
var flow = protractor.promise.controlFlow();
function waitOne() {
return protractor.promise.delayed(3000);
}
function sleep() {
flow.execute(waitOne);
}
browser.get('http://localhost:3000/');
sleep()
expect(browser.getTitle()).toEqual('Find Homes for Sale, Rent & Real Estate Listings Nationwide at Homes.com');
sleep()
var search = element.all(by.css("input[name='search_query']"));
sleep()
search.sendKeys('anything'); // this is not working
});
});
如果它是一个角度的应用程序,为什么你设置'ignoreSynchronization = true'? – Gunderson
我收到同步错误 – Jonathan
您是否尝试延长超时?大多数超时默认为10秒,在我看来这很低。 [超时参考](https://github.com/angular/protractor/blob/master/docs/timeouts.md) – Gunderson