In general, the Internet rejected, the initial task was: to create a Windows form in which a certain site will be loaded and to autologize, did not work. Made a login using the button
, says that the login and password is not correct. Checked in the explorer, all the data fit.
I spread the body of the program, if anyone knows how, lay out 2 examples - one by the second login - automatically after the page loads.
here is my code.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication3 { public partial class Form1 : Form { WebBrowser web = new WebBrowser(); public Form1() { InitializeComponent(); web.Navigate("http://public.servicebox.peugeot.com"); button1.Enabled = false; } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { button1.Enabled = true; } private void button1_Click(object sender, EventArgs e) { foreach (HtmlElement html in web.Document.GetElementsByTagName("input")) { if (html.GetAttribute("name") == "userid") { html.SetAttribute("value", "AP34593969"); } if (html.GetAttribute("name") == "password") { html.SetAttribute("value", "mazdacx77"); } web.Document.GetElementById("btsubmit").InvokeMember("click"); } } } }