gpt4 book ai didi

excel - 自动化错误。通过 Selenium 和 VBA 使用 Excel 的灾难性故障错误

转载 作者:行者123 更新时间:2023-12-04 22:24:48 25 4
gpt4 key购买 nike

我正在尝试通过 selenium VBA 填写网络表单。我使用了一些过去运行良好的代码。现在我已经更新到新版本的办公室,现在当我尝试相同的代码时,它说

" Automation error. Catastrophic failure"


    Sub Rel_join()

Dim bot As New ChromeDriver
bot.Start "chrome", "******"
Dim x, y,w
bot.Get "/"
'bot.Window.Maximize
'login
bot.Wait 1500
bot.FindElementByXPath("//*[@id='lang-menu']/li[5]/a").Click
bot.Wait 500
'select department
d = "********"

Set ele = bot.FindElementById("ddldept").AsSelect
ele.SelectByText [d]
bot.FindElementByXPath("//input[@id='txtusername']").SendKeys "*****"
bot.FindElementByXPath("//input[@id='txtpwd']").SendKeys "******"
Stop
'Navigate to service book
bot.Get "***********URL"

For y = 4 To 4
** x = ThisWorkbook.Sheets("sheet1").Range("w" & y).Value**
cSCRIPT = "document.getElementById('txtempcd').value='" & x & "'"
bot.ExecuteScript cSCRIPT
Stop
cSCRIPT = "document.getElementById('Save').click()"
bot.ExecuteScript cSCRIPT
bot.SwitchToAlert.Accept
bot.Wait 3000
Next y
End Sub


我还注意到此错误显示在行上
 ** x = ThisWorkbook.Sheets("sheet1").Range("w" & y).Value**

最佳答案

此错误消息...

Automation error. Catastrophic failure

...暗示有一个 自动化错误 在访问基于 的 Excel 工作表时办公室 365 .

根据 Automation error: Catastrophic failure Problem with Excel 2016 中的讨论主要问题与 的版本有关Excel 附带 办公室 365 与提供给企业用户的版本不同。

解决方案

最简单的解决方案是将文件另存为 Excel 二进制工作簿 并在您的自动化测试中使用它

关于excel - 自动化错误。通过 Selenium 和 VBA 使用 Excel 的灾难性故障错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58946545/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com