且构网

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

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

更新时间:2022-12-15 15:45:47

driver 初始化后为 driver 生命周期定义一次隐式等待,并设置driver 查找敌人 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 处于 cretin 条件的给定时间,并且需要在每次等待条件满足时使用.

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.