Simple protractor test for isElementPresent failing with unsupported locator strategy

后端 未结 4 2045
深忆病人
深忆病人 2021-02-09 22:30

My test:

it(\'should allow login\', function() {
  browser.get(\'index.html\');

  $(\'#username\').sendKeys(\'administrator\');
  $(\'#password\').sendKeys(\'pa         


        
4条回答
  •  梦如初夏
    2021-02-09 23:09

    $('#logout') is a WebElement. isElementPresent takes a locator, like by.css

    $('#username').sendKeys('administrator');
    $('#password').sendKeys('password');
    $('#login').click();
    
    var logout = by.css('#logout');
    browser.wait(function() { return $p.isElementPresent(logout); }, 8000);
    expect($p.isElementPresent(logout)).toBeTruthy();
    

提交回复
热议问题