Protractor Check if Element Does Not Exist

后端 未结 6 2025
长情又很酷
长情又很酷 2021-02-05 02:56

I have a setting in my angular based website that turns a dropdown on and off. If it is off, then it does not show on the main page.

With Protractor, I need to check to

6条回答
  •  梦如初夏
    2021-02-05 03:10

    These answers do not wait for the element to disappear. In order to wait for it to disappear you need to use ExpectedConditions like below. InvisibilityOf detects whether an element has left the DOM. See it in the docs here: https://www.protractortest.org/#/api?view=ProtractorExpectedConditions.

      export const invisibilityOf = (el) =>
         browser.wait(ExpectedConditions.invisibilityOf(el) as any, 12000, 
        'Element taking too long to disappear in the DOM')
      const el = element(by.css(arg1))
      return invisibilityOf(el)
    

提交回复
热议问题