-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使用
はエラーは、なぜ私は知らない
ログイン用に「innerText」を、パスワード用に「value」を選択した場合ord? – SeM
パスワードに値を使用するとエラーが挿入され、値は視覚的に挿入されるように見えます。 –
あなたの「ウェブシステム」ですか? GUIを自動化しようとするのではなく、Web-APIを使用できますか?そのようなシステムのほとんどのプロバイダは、ボットがそれを使用することを明示的に望んでいません。 – Fildor