這是登錄按鈕。所以如果它存在,它應該登錄。如果不是,應該繼續進行編碼。如果登錄按鈕存在,請登錄 - 量角器
<button class="md-button ng-scope
md-ink-ripple layout-align-xs-start-start"
type="button" ng-transclude="" data-menu-item="login" ng-click="vm.login()"
ng-if="!vm.isAuthenticated()" layout-align-xs="start start"
aria-label="person_outline global.menu.account.login">
<md-icon class="ng-scope material-icons">person_outline</md-icon>
<label translate="" class="ng-scope">Giriş</label>
<div class="md-ripple-container"></div>
</button>
我試圖
describe('Product dashboard module', function() {
console.log('Product Dashboard Test starting');
var dashboardPageObject = new DashboardPageObject();
beforeEach(function() {
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(element(by.css('ng-click="vm.login()"')).then(function() {
console.log('-Loging in');
//here will be login jobs
})
})
但
Failed: element(...).then is not a function
我改變這個
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(element.all(by.cssContainingText('ng-click="vm.login()"'))
.then(function() {
錯誤是:
Failed: Cannot read property 'bind' of undefined
我嘗試了很多東西。
失敗:錯誤等待量角器與頁同步:「window.angular未定義這可能是要麼因爲這是一個非角度頁面,或者因爲你的測試涉及客戶端導航,這可能會干擾量角器的引導。詳情請參閱http://git.io/v4gXM「 – mark
你可以在瀏覽器中添加'browser.ignoreSynchronization = true' beforeEach()的開頭,還需要使用'browser.get()'方法導航到相應的url。 –
InvalidElementStateError:無效元素狀態:無法在'Document'上執行'querySelectorAll':'ng-click =「vm.login()」'不是有效的選擇器。也許是因爲沒有登錄按鈕,因爲已經登錄? – mark