我正在尝试使用 VBA (Excel) 从列表框(表元素实际上是文本区域)中选择一个项目。
\n\n我可以选择该项目(通过更改值),但问题是当我按下“保存”按钮时,网站返回以下错误:
\n\n\n\n\n当状态为待处理或已解决时,“状态原因”字段需要一个值。从菜单中选择状态原因。(ARERR 1291220)
\n
我认为发生这种情况是因为列表框没有更新。
\n\n列表框(不是真正的列表框):
\n\n<textarea title="" class="text sr " id="arid_WIN_1_1000000881" style="left: 117px; top: 0px; width: 223px; height: 21px;" rows="1" cols="20" wrap="off" readonly="" arencryptdataatrest="0" arautoctt="400" arautocak="0" mdd="1" mstyle="2" armenu="SYS:RSN:StatusReason-Q-HPD-HelpDesk" maxlen="40"></textarea>\nRun Code Online (Sandbox Code Playgroud)\n\n我的代码:
\n\nDim post As Object, evt As Object\nSet evt = .Document.createEvent("keyboardevent")\nevt.initEvent "change", True, False\n\nSet post = .Document.getElementByID("arid_WIN_1_1000000881")\n post.Value = "No Further Action Required"\npost.dispatchEvent evt\nRun Code Online (Sandbox Code Playgroud)\n\n如果您需要更多信息,请告诉我。
\n\n[更新]
\n\n下面是按下列表框后显示的表格的完整代码
\n\n<div class="MenuOuter" style="left: 338px; top: 127px; …Run Code Online (Sandbox Code Playgroud) 我正在编写一个程序来帮助我的客户从网站下载发票 PDF,我第一次使用drv.Navigate().GoToUrl(URL);. 之后程序休眠一段时间,当清醒时开始搜索我客户的电子邮件(使用S22 DLL),如果他找到某个电子邮件,则从电子邮件中提取链接并使用(第二次)drv.Navigate().GoToUrl(URL);。但这次我得到了一个例外
浏览上下文已被丢弃
我已经尝试了所有可能的方法,但最“令人震惊”的是我在 Google 上找不到关于此错误的任何信息,也没有在 Selenium 文档中找到任何信息。
我不明白什么意思
我确定链接有效,因为是同一个链接。
受此问题影响的代码下方
PS:第一次下载与第二次下载完全一样。
public static int Go(string URL, ImapClient EmailClient, uint mUID, bool isFromOutlook) {
// While the Firefox driver isn't initialized, wait for it
while (isDrvInit != 1 && isDrvInit != 2)
Thread.Sleep(1);
// If the Firefox driver was not able to initialize, we can't procede further
if (isDrvInit == 2)
return 0;
try {
drv.Navigate().GoToUrl(URL); // Here the program throw …Run Code Online (Sandbox Code Playgroud)