How to wait for when an element is removed from DOM?

后端 未结 1 484
轻奢々
轻奢々 2021-02-08 20:21

I run into this issue whenever I try to wait until an DOM element is removed from the current DOM tree on the web page that my protractor test is testing. I already got a hang o

相关标签:
1条回答
  • 2021-02-08 21:07

    not sure where you got protractor.until from as that's not part of the core library. This is how you would do it with protractor:

    var el = element(by.css('.your-css-class'));
    return browser.wait(function() {
      return el.isPresent().then(function(present) {
        return !present;
      })
    });
    

    Once feat(expectedConditions) is in (probably protractor 1.7), you can do:

    var EC = protractor.ExpectedConditions;
    
    var el = element(by.css('.your-css-class'));
    return browser.wait(EC.not(EC.presenceOf(el)));
    
    0 讨论(0)
提交回复
热议问题