WebDriver的默认隐式等待值是多少

WebDriver的默认隐式等待值是多少

本文介绍了Selenium WebDriver的默认隐式等待值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Selenium WebDriver的默认隐式等待值是什么?

What is Selenium WebDriver's default implicit wait value?

Selenium文档说它是"0",但是当我在一个新项目上调用.findElement时,DOM上不存在任何元素,它似乎会在一段时间后得到TimeoutException而不是无限期地挂起. "0"表示永远等待吗?

The selenium documentation says that it is "0" but when I call .findElement on a brand new project, where a element doesn't exist on the DOM, it seems to get a TimeoutException after a while rather than hang indefinitely. Does "0" mean wait forever or not?

推荐答案

隐式等待的默认值确实为零,这意味着(并且一直意味着)如果找不到该元素,则会立即使findElement失败. "您不应该直接从findElement收到TimeoutException.使用WebDriverWait构造,在使用所谓的显式等待"时,您可能只会收到该信息.

The default value for implicit waits is indeed zero, which means (and always has meant) "fail findElement immediately if the element can't be found." You shouldn't be receiving a TimeoutException directly from findElement. You'll likely only be receiving that when using a so-called "explicit wait", using the WebDriverWait construct.

这篇关于Selenium WebDriver的默认隐式等待值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 12:32