2017-10-26 5 views
-1

C#WebBrowserを使用してWebシステムにログインする簡単なボットを作成しようとしています。C#WebBrowserを使用してWebシステムにログインするためのボット

 //Get the WebBrowser document 
     doc = wbNavegador.Document; 
     //Get login and password input 
     HTMLInputElement login = (HTMLInputElement)doc.GetElementById("username").DomElement; 
     HTMLInputElement password = (HTMLInputElement)doc.GetElementById("password").DomElement; 
     //Insert data 
     login.innerText = "admin"; 
     password.innerText = "@[email protected]"; 
     //Get login button 
     var buttons = doc.GetElementsByTagName("Button"); 
     //Wait 1 second or the login input wont work 
     Util.Utilidades.WaitNSeconds(1); 
     //Call angular action "login()" 
     foreach (HtmlElement button in buttons) 
     { 
      if (button != null) 
      { 
       if (button.GetAttribute("ng-click").Equals("login()")) 
       { 
        button.InvokeMember("Click"); 
       } 
      } 
     } 

私の問題は、私は、ログイン/ password.valueを使用して、私は、ログイン()関数を呼び出すとき、私は、ログイン作品のinnerText使用しますが、パスワードの値がに行くときの入力は、空であるというエラーを取得し、ありますプレースホルダー。エラーのinnerText使用

エラーは、なぜ私は知らない

Insert the username

+0

ログイン用に「innerText」を、パスワード用に「value」を選択した場合ord? – SeM

+0

パスワードに値を使用するとエラーが挿入され、値は視覚的に挿入されるように見えます。 –

+0

あなたの「ウェブシステム」ですか? GUIを自動化しようとするのではなく、Web-APIを使用できますか?そのようなシステムのほとんどのプロバイダは、ボットがそれを使用することを明示的に望んでいません。 – Fildor

答えて

-1

"ユーザ名を挿入します" と言う値を使用して

Insert the password

"パスワードの挿入" と言うI password.value = "@[email protected]"; password.innerText = "@[email protected]";を入力して作業しました

関連する問題