Vba .submit方法在尝试登录时不起作用
我试图登录到一个网页以获取一些表,但我的代码无法登录 这是login按钮的inspect元素Vba .submit方法在尝试登录时不起作用,vba,web-scraping,Vba,Web Scraping,我试图登录到一个网页以获取一些表,但我的代码无法登录 这是login按钮的inspect元素 <a onclick="OpenWindowAndLogon();" id="lnkLogon" class="fltBtn" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("lnkLogon", "", true, &am
<a onclick="OpenWindowAndLogon();" id="lnkLogon" class="fltBtn" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("lnkLogon", "", true, "", "default.aspx", false, true))">
<span>Login</span>
'在这里,它不做任何事情,而假设登录到页面'
`.submit`
End Sub
下面显示的是通过将每个元素和按钮的ID作为目标来管理登录过程
Option Explicit
Public Sub Login()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate "https://www.teambinder.com/TeamBinder184/Logon/default.aspx"
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
.querySelector("#txtUserId").Value = 8888
.querySelector("#txtCompanyId").Value = 8888
.querySelector("#txtPassword").Value = 8888
.querySelector("#lnkLogon").Click
End With
While .Busy Or .readyState < 4: DoEvents: Wend
Stop '<== Delete me later
'.Quit '<== Remember to quit application
End With
End Sub
Option Explicit
Public Sub Login()
Dim ie As InternetExplorer
Set ie = New InternetExplorer
With ie
.Visible = True
.navigate "https://www.teambinder.com/TeamBinder184/Logon/default.aspx"
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
.querySelector("#txtUserId").Value = 8888
.querySelector("#txtCompanyId").Value = 8888
.querySelector("#txtPassword").Value = 8888
.querySelector("#lnkLogon").Click
End With
While .Busy Or .readyState < 4: DoEvents: Wend
Stop '<== Delete me later
'.Quit '<== Remember to quit application
End With
End Sub