掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TWebBrowserの検索結果から「次へ」のボタンを自動的にクリックする方法は? (ID:38926)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
WebBrowserを使って検索プログラムを作っています。指定サイトを開いて検索を行う迄は以下のソースの様に出来るのですが、良くあるブラウザー内の「次へ」ボタンを自動的にクリックする事が出来ません・・・解る方がいらっしゃいましたらお教え下さい。 procedure TForm1.Button1Click(Sender: TObject); begin WebBrowser1.Navigate(http://sample.co.jp); end; procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); var s :String; iDoc :IHtmlDocument2; I :integer; ov :OleVariant; iDisp :IDispatch; iColl :IHTMLElementCollection; iInputElement: IHTMLInputElement; begin WebBrowser1.ControlInterface.Document.QueryInterfaceIID_IHTMLDocument, iDoc); if not assigned(iDoc) then Exit; ov := 'INPUT'; IDisp := iDoc.all.tags(ov); if assigned(IDisp) then begin IDisp.QueryInterface(IID_IHTMLElementCollection, iColl); if assigned(iColl) then begin for I := 1 to iColl.Get_length do begin iDisp := iColl.item(pred(I), 0); iDisp.QueryInterface(IID_IHTMLInputElement, iInputElement); if assigned(iInputElement) then begin if (iInputElement.type_='text') and (InputElement.name='login') then iInputElement.value:= UserName; if (iInputElement.type_= 'password') and (iInputElement.name='passwd') then iInputElement.value:= Password; if (iInputElement.type_= 'login') then begin IsLogin := True; iInputElement.form.submit; end; end; end; end; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.