且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用显式等待替换隐式等待(selenium webdriver& java)

更新时间:2022-12-15 16:07:13

隐式等待是在驱动程序初始化之后定义的驱动程序生命周期,它设置驱动程序的最大时间来查看敌人 WebElement

Implicit wait is defined once right after the driver initialization for the driver life time, and it sets the maximum amount of time for the driver to look foe WebElement.

显式等待用于等待 WebElement 处于克制状态的给定时间,并且每次等待满足条件时都需要使用。

Explicit wait is used to wait up to the given amount of time for the WebElement to be in cretin condition, and need to be used each time you are waiting for condition to met.

你不能用显式等待替换隐式等待定义,因为它们是不同的东西在这一点上没有条件等待。

You can't "replace" the implicit wait definition with explicit wait, as they are different thing and there is no condition to wait for in this point.