无法在量角器和CoffeeScript中访问WebDriverJS等待“直到” [英] Can't access WebDriverJS wait 'until' in Protractor and CoffeeScript

查看:64
本文介绍了无法在量角器和CoffeeScript中访问WebDriverJS等待“直到”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要等待模式关闭,以便等待缺少元素。我正在尝试执行以下操作:

I need to wait for a modal to close so I am waiting for the absence of an element. I'm trying to do something like this:

browser.driver.wait until.stalenessOf(By.css '.modal-header')

不幸的是Coffeescript保留了直到 。所以我尝试使用:

Unfortunately Coffeescript has reserved until. So I tried using:

browser.driver.wait browser.driver.until.stalenessOf(By.css '.modal-header')

但未定义(直到那是)。 browser.driver 存在,但不包含 until

but it is undefined (until that is). browser.driver exists but it doesn't contain until.

如何访问直到对象?另外,还有另一种方法可以等待元素不再出现在页面上吗?

How can I access the until object? Also, is there another way to wait until an element is no longer on the page?

推荐答案

您可以使用 isPresent()函数代替:

browser.wait ->
  not element(By.css '.modal-header').isPresent()
,
  5000

注意: isPresent()在隐式等待元素完成之前不会返回false。如果您将 browser.manage()。timeouts()。implicitlyWait 属性设置得很高,则可能要暂时减小其值。

NOTE: isPresent() will not return false until it has finished implicitly waiting for the element, so if you have set the browser.manage().timeouts().implicitlyWait property very high you may want to temporarily decrease its value.

这篇关于无法在量角器和CoffeeScript中访问WebDriverJS等待“直到”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆