2016-09-16 14 views
-1

私が使用してWebページに移動しています:Internet Explorerオブジェクトからウェブページに移動して「ログイン」ボタンをクリックする方法は?

Dim IE As Object = CreateObject("InternetExplorer.Application") 
IE.Navigate("http://www.mypage.com") 
IE.Document.GetElementById("login").SetAttribute("Value", "myusername") 
IE.Document.GetElementById("password").SetAttribute("Value", "mypassword") 

'I can't get the submit button to work here. 

'the button is coded in html like this: 
<button class="btn btn-default pull-right" onclick="return checkCookies();" type="submit" value="Login">Login</button> 

私はそのボタンをクリックすることはできませんよ。どんな助けもありがとう。ありがとう

+0

1これまでに失敗したことは何ですか? 2 - このコードスニペットは仮説的な例になっていますか? google.comにはログインページがないため、ユーザー名とパスワードの実際のログインページの要素IDはログイン/パスワードではなく電子メール/パスワードです。 – soohoonigan

+0

@soohooniganこれは例示的なWebページです... ..... DUH! *私はウェブページを変更しました。 – JustAnotherPersonYouDontKnow

+0

よく知っている、私は前にcefsharpプロジェクトでGoogleにサインインしなければならなかった... – soohoonigan

答えて

0
Dim btns 
Set btns = IE.Document.GetElementsByClassName("btn btn-default pull-right") 
For Each btn In btns 
    If Button.InnerHTML.Contains("Login") Then 
     btn.Click 
     Exit For 
    End If 
Next 
+0

私はウェブブラウザを使用していない。 – JustAnotherPersonYouDontKnow

関連する問題