我一直在尝试修改代码以使其正常工作,但没有成功。我需要以访客身份提交以下网页:

<div class="lotusBtnContainer">
<input type="submit" class="lotusBtn" value="Access as a Guest"onclick="javascript:asGuest();">
<input type="submit" class="lotusBtn" value="Log in and Access" onclick="javascript:asUser();">
<span class="lotusAction"> &nbsp;</span>
</div>


到目前为止,这就是我所拥有的,因为按钮没有ID,所以我不确定该如何解决:

Dim IntExpl As Object
Set IntExpl = CreateObject("InternetExplorer.Application")
With IntExpl
      .navigate "webpage url"
      .Visible = True
      Do Until IntExpl.readyState = 4
Loop
    '.document.getElementsByName("subAction")(0).Click
End With
End Sub

最佳答案

这工作了。

Dim IntExpl作为对象

    Set IntExpl = CreateObject("InternetExplorer.Application")


    With IntExpl
          .navigate "https://febontap.victoria.ibm.com/forms/anon/org/notify/guestselection.html?originatingUrl=..%2f..%2f..%2flanding%2forg%2fapp%2ff373ed45-3637-4662-8fb8-a40a0bd621db%2flaunch%2findex.html%3fform%3dF_Form1&guest=..%2fapp%2ff373ed45-3637-4662-8fb8-a40a0bd621db%2flaunch%2findex.html%3fform%3dF_Form1&user=..%2f..%2f..%2fsecure%2forg%2fapp%2ff373ed45-3637-4662-8fb8-a40a0bd621db%2flaunch%2findex.html%3fform%3dF_Form1"
          .Visible = True
          Do Until IntExpl.readyState = 4
    Loop


    .document.getElementsByClassName("lotusBtn")(0).Click



    End With

关于javascript - VBA JavaScript onclick,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25359318/

10-09 23:53