Отправляеш постом на "http://limoncash.com/": Далее парсишь ответ, если "Ошибка ввода." то выводишь сообщение о ошибке, если нет - делаешь что тебе нужно...
Это то я сделал: Code: wb.Document.GetElementById("form[user]").InnerText = textBox1.Text; wb.Document.GetElementById("form[password]").InnerText = textBox2.Text; wb.Document.GetElementById("enter").Focus(); SendKeys.Send("{ENTER}"); Как узнать валидный или нет че-то не допрет? Как парсить текст?
И это ясно( вот код Code: wb.Document.GetElementById("form[user]").InnerText = textBox1.Text; wb.Document.GetElementById("form[password]").InnerText = textBox2.Text; wb.Document.GetElementById("enter").Focus(); SendKeys.Send("{ENTER}"); do { Application.DoEvents(); } while (wb.IsBusy != false); if (curr.Equals("http://limoncash.com/?mod=news&page=1")) { MessageBox.Show("Yes"); wb.Stop(); } else { MessageBox.Show("No"); wb.Stop(); } Просто кнопка даже не нажалась а No уже вылетело(( Что делаю не так?
я изучаю с# так что могу ошибаться смотри wb.Document.GetElementById("form[user]").InnerText = textBox1.Text; wb.Document.GetElementById("form[password]").InnerText = textBox2.Text; wb.Document.GetElementById("enter").Focus(); SendKeys.Send("{ENTER}"); //авторизуемся вроде верно do { Application.DoEvents(); } while (wb.IsBusy != false);//попробуй тут тру поставить if (curr.Equals("http://limoncash.com/?mod=news&page=1")) { MessageBox.Show("Yes"); wb.Stop(); } else { MessageBox.Show("No"); wb.Stop(); } вообще у тя где ошибку выдает ?
Проблема решена) С# код Code: string curr = wb.Url.ToString(); if (curr.Equals("http://limoncash.com/")) { wb.Document.GetElementById("form[user]").InnerText = textBox1.Text; wb.Document.GetElementById("form[password]").InnerText = textBox2.Text; wb.Document.GetElementById("enter").Focus(); SendKeys.Send("{ENTER}"); do { Application.DoEvents(); } while (wb.IsBusy != false); } else if (curr.Equals("http://limoncash.com/?mod=news&page=1")) { MessageBox.Show("Yes"); wb.Stop(); } else { MessageBox.Show("No"); wb.Stop(); } }
string curr = wb.Url.ToString(); if (curr.Equals("http://limoncash.com/")) ахахаха точно ) где он будет искать поля для вода,красава + те самому ток допер
как можно заменить эти две строчки? Code: wb.Document.GetElementById("enter").Focus(); SendKeys.Send("{ENTER}");
на Delphi это будет вот так: Code: function CheckAcc(login, pass: string): boolean; var HTTP : TidHTTP; Post : TSTringList; Str : string; begin HTTP := TidHTTP.Create(nil); Post := TStringList.Create; with Post do begin Add('form[user]=' + login); Add('form[password]' + pass); Add('enter='); end; Str := HTTP.Post('http://limoncash.com/', Post); // Проверка (если рабочий ак, то True, если же нет, то False) If Pos('Ошибка ввода', str) <> 0 Then Result := False else Result := True; Post.Free; HTTP.Free end; вроде ничего не забыл)))