Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Controlling TWebBrowser Page controls ?

Posted on 2008-10-03
2
Medium Priority
?
295 Views
Last Modified: 2012-05-05
In code, how can I traverse a TWebBrowser's page and find a list control by its ID (LogBookPanel1_ddLogType) and select a item from the list?

thanks

 <select name="LogBookPanel1$ddLogType" id="LogBookPanel1_ddLogType">
<option selected="selected" value="-1">- Select One -</option>
<option value="13">Retrieve from WCMC</option>
<option value="19">Grab it from somewhere else</option>
<option value="4">Write note</option>
<option value="48">Discovered it</option>
<option value="-1">- Select One -</option>
</select>
0
Comment
Question by:geocoins-software
2 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 22637892
not exactly what you looking for but there are code snippets how to access elements of web-page:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21372503.html
especially first comment by calinutz can be helpfull

ziolko.
0
 
LVL 5

Accepted Solution

by:
wd123 earned 1000 total points
ID: 22663457
as you wish =)
const html='<html><body><select name="LogBookPanel1$ddLogType" id="LogBookPanel1_ddLogType">'+
'<option selected="selected" value="-1">- Select One -</option>'+
'<option value="13">Retrieve from WCMC</option>'+
'<option value="19">Grab it from somewhere else</option>'+
'<option value="4">Write note</option>'+
'<option value="48">Discovered it</option>'+
'<option value="-1">- Select One -</option>'+
'</select></body></html>';
var el:OleVariant;
begin
WebBrowser1.Navigate('about:blank');
while WebBrowser1.ReadyState<>4 do begin Application.ProcessMessages;sleep(50);end; //wait
WebBrowser1.OleObject.document.write(html);//simulate page
el:=WebBrowser1.OleObject.document.getElementById('LogBookPanel1_ddLogType');
el.value:=4;//select 'Write note'

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question