excel - 如何让 selenium 等待页面在 Selenium 中完全加载 - Excel VBA 的包装器?

标签 excel selenium selenium-webdriver vba

Selenium 的哪些代码或函数 - 要使用 Excel VBA 的包装器,以便程序等待页面完全加载然后执行其他命令?

最佳答案

最新版本在执行所需操作之前隐式等待目标元素存在。例如, driver.FindElementById("...").Click 默认会在抛出错误前的 3 秒内尝试查找元素。

这种隐式等待可以全局定义:

driver.Timeouts.ImplicitWait = 5000 ' 5 seconds

以及单独:
driver.FindElementById("id", timeout:=10000).Click  ' implicitly wait of 10sec
driver.FindElementById("id", timeout:=0).Click  ' no implicit waiting

为运行浏览器的服务器设置超时:
driver.Timeouts.Server = 120000 ' 2 mins

要使用上述示例获取最新版本:https://github.com/florentbr/SeleniumBasic/releases/latest

关于excel - 如何让 selenium 等待页面在 Selenium 中完全加载 - Excel VBA 的包装器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32348486/

相关文章:

vba - 多点正则表达式匹配较少的 for 循环和较少的类重新初始化。优化

excel - 填充多维数组

java - 如何使用 Selenium 从 div 元素获取文本仅返回 "."

python - 使用 Python 3.6 抓取 Duckduckgo

selenium - 在测试自动化中使用 Select 元素而不是实际执行 'element.click()' 错误做法吗?

vba - Excel vba将值从一张表更改为另一张表

c# - 使用具有 Windows 身份验证的 Selenium Webdriver(在 Chrome 中)C#/ASP.Net

python - 如何使用 selenium 单击图像链接导致 TimeoutException 错误

python - 更改 xpath selenium python

excel - 使用安装工厂自动安装并启用 Excel 插件