我一直試圖使用VBA自動提交登錄憑證,並且我可以獲取用戶名和密碼字段來填充,但我無法獲取代碼來單擊登錄按鈕。我已經嘗試了很多我在這裏找到的解決方案以及其他網站,並且無法使其工作。這裏是我的代碼(我已經採取了任何試圖點擊該按鈕):我正在嘗試使用VBA單擊網站上的「登錄」按鈕以自動登錄
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub iTradeLogIn()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.oms.itradenetwork.com/secure/login/logon.cfm? _Key=8C049059F2DD44009E"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.ReadyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
HTMLDoc.all.UserName.Value = "MyName"
HTMLDoc.all.Password.Value = "MyPassword"
'Code Here to click the button
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
下面是一些源代碼,以及在那裏我想登錄爲:
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
document.body.style.overflow = "hidden";
var tb = new Ext.Toolbar({
items: [{
xtype: 'splitbutton',
id: 'setLanguage',
text: 'English',
menu: new Ext.menu.Menu({
items: [
{text: 'English', id: 'EN', handler: changeLanguage},
{text: 'Español', id: 'ES', handler: changeLanguage},
{text: 'Deutsch', id: 'DE', handler: changeLanguage},
{text: 'Français', id: 'FR', handler: changeLanguage},
{text: 'Nederlands', id: 'NL', handler: changeLanguage}
]
})
}, '->', {
text: 'Logon',
id: 'Logon',
disabled: true,
handler: performLogon,
formBind: true
}]
});
var logonForm = new Ext.FormPanel({
labelWidth: 100,
frame: true,
title: 'Member Logon',
id: 'LogonForm',
bodyStyle: 'padding: 5px 5px 0',
width: 350,
defaults: {width: 200},
defaultType: 'textfield',
floating: true,
shadow: 'drop',
shadowOffset: 15,
monitorValid: true,
buttonAlign: 'left',
items: [{
fieldLabel: 'User Name',
id: 'UserName',
name: 'UserName',
allowBlank: false,
maxLength: 50
},{
fieldLabel: 'Password',
id: 'Password',
name: 'Password',
inputType: 'password',
maxLength: 20
}, new Ext.form.Checkbox({
fieldLabel: '',
labelSeparator: '',
id: 'RememberMe',
name: 'RememberMe',
boxLabel: 'Remember Me?',
style: 'margin-right: 8px',
checked: getCookie('REMEMBERME') == "true" ? true : false
})],
fbar: tb
該網站創建與Sencha框架的方式 – NineBerry