AngularJs Protractor: Element in slide out menu not visible

两盒软妹~` 提交于 2019-12-01 00:09:33
alecxe

You need to open up the menu before locating and clicking the submenu:

element(by.css('nav.menu > md-content')).click();
element(by.css('nav.menu > md-content > button[ng-click="logoff()"]')).click();

You may also need to use a elementToBeClickable expected condition to wait for the submenu to become clickable (needs protractor 1.7 or above):

var EC = protractor.ExpectedConditions;
var logoff = element(by.css('nav.menu > md-content > button[ng-click="logoff()"]'));

browser.wait(EC.elementToBeClickable(logoff), 10000);
logoff.click();

You can also use a promise to wait for the action to complete

element(by.id('menu')).click().then(function(){
    element(by.id('link')).click();
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!