AngularJs Protractor: Element in slide out menu not visible

前端 未结 2 1266
北荒
北荒 2021-01-06 18:40

I\'m back with more Protractor Q&A. So, I am coming across an issue when trying for find an element that is inside a slide out menu.

Snippet of html:

         


        
2条回答
  •  猫巷女王i
    2021-01-06 19:08

    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();
    

提交回复
热议问题