Selenium WebDriver 中的隐式等待和显式等待有什么区别? [英] What is difference between Implicit wait and Explicit wait in Selenium WebDriver?

查看:50
本文介绍了Selenium WebDriver 中的隐式等待和显式等待有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Selenium WebDriver 中有隐式等待和显式等待.它们有什么区别?

There are Implicit and Explicit wait in Selenium WebDriver. What's the difference between them?

请分享有关 Selenium WebDriver 的知识.请使用 Implicit & 显示实时示例显式等待.

Kindly share the knowledge about Selenium WebDriver. Please show the real time example with Implicit & Explicit wait.

推荐答案

查看以下链接:

  • 隐式等待 - 它通过轮询 DOM 指示 Web 驱动程序等待一段时间.一旦您声明了隐式等待,它将在 Web 驱动程序实例的整个生命周期中可用.默认情况下,该值为 0.如果您设置更长的默认值,则该行为将根据浏览器/驱动程序实现定期轮询 DOM.

  • Implicit Wait - It instructs the web driver to wait for some time by poll the DOM. Once you declared implicit wait it will be available for the entire life of web driver instance. By default the value will be 0. If you set a longer default, then the behavior will poll the DOM on a periodic basis depending on the browser/driver implementation.

显式等待 + ExpectedConditions - 这是自定义的.如果我们希望执行等待一段时间直到达到某个条件,就会使用它.

Explicit Wait + ExpectedConditions - It is the custom one. It will be used if we want the execution to wait for some time until some condition achieved.

这篇关于Selenium WebDriver 中的隐式等待和显式等待有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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