我正在尝试填充通过单击按钮创建的Web表单,而该按钮不会加载新页面。当我尝试与表单的Elements进行交互时,Excel会抛出424错误对象。
似乎Excel不承认单击按钮后创建的新字段,但是我不知道如何在不重新加载页面的情况下获取新元素。
With ie
.Navigate "https://accounts/New/"
While .Busy Or .ReadyState < 4: DoEvents: Wend
With .Document
.getElementById("DeliverDateTextBox").Value = docDate
.getElementById("DateTextBox").Value = docDate
.getElementById("DueDateTextBox").Value = docDate
.getElementById("TheirRefTextBox").Value = docDescription
.getElementById("CurrCodeTextBox").selectedIndex = 1
.getElementById("NewLine2").Click
End With
While .Busy Or .ReadyState < 4: DoEvents: Wend 'Waiting for the page to be ready after the click?
With .Document
.getElementById("Text1").Value = "Hello" 'Code throws an error: 424 Object required (textarea)
.getElementById("VATCode").Value = "A1"'Code throws an error: 424 Object required (input area)
.getElementById("grosstonet").Click
End With
End With
这是我要与之交互的HTML代码:
对于我尝试放置“ Hello”的第一个元素
<textarea name="Detail" rows="3" cols="20" id="Text1"
tabindex="530" class="Small"
style="color:Black;background-color:White;border-style:Inset;font-family:Verdana;font-size:8pt;height:84px;width:320px;">
</textarea>
对于第二个元素,我尝试放置“ A1”
<input name="VAT" type="text" value="A3" id="VATCode"
tabindex="600" style="color:Black;background-color:White;border-style:Inset;font-family:Verdana;font-size:8pt;width:30px;"
autocomplete="off">