Vba 无法使用excel登录网页,错误424需要对象
我正在尝试登录此网页, 使用VBA。调试表明,当用户名行处于活动状态时,VBA抛出一个错误424对象。显然,它无法填充用户名数据 代码如下: 子测试 设置ie=CreateObjectInternetExplorer.application 可见=真实 导航https://www.fois.indianrail.gov.in/ecustomer/JSP/QryInsight.jsp 用ie文件 .getElementByIdtxtUserId.Value=ABCDE .getElementByIdtxtPassword.Value=ABCDE .getElementByIdsubmit.Click 以 端接头Vba 无法使用excel登录网页,错误424需要对象,vba,excel,authentication,internet-explorer,dom,Vba,Excel,Authentication,Internet Explorer,Dom,我正在尝试登录此网页, 使用VBA。调试表明,当用户名行处于活动状态时,VBA抛出一个错误424对象。显然,它无法填充用户名数据 代码如下: 子测试 设置ie=CreateObjectInternetExplorer.application 可见=真实 导航https://www.fois.indianrail.gov.in/ecustomer/JSP/QryInsight.jsp 用ie文件 .getElementByIdtxtUserId.Value=ABCDE .getElementByI
有人能帮我在登录到给定网页时调试问题吗?请看下面的示例:
Option Explicit
Sub Test()
Dim oIE As Object
Set oIE = CreateObject("InternetExplorer.application")
With oIE
.Visible = True
.Navigate ("https://www.fois.indianrail.gov.in/ecustomer/JSP/QryInsight.jsp")
Do While .ReadyState < 4 Or .Busy
DoEvents
Loop
With .Document
Do While .ReadyState <> "complete"
DoEvents
Loop
With .parentWindow.frames("frmCUMain").document
.getElementsByName("txtUserId")(0).Value = "ABCDE"
.getElementsByName("txtPassword")(0).Value = "ABCDE"
.getElementsByName("cmdLogin")(0).Click
End With
End With
End With
End Sub
该页面有框架,您提供的URL是顶部框架。登录部分的实际URL是:假设Logan是正确的,您将希望导航到框架的文档,然后通过ID获取元素。您应该能够通过名称、类或ID获取框架。请尝试在VBS中使用.getElementsByNameTextSerId.value使用相同的代码