Solved

Controlling TWebBrowser Page controls ?

Posted on 2008-10-03
2
288 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 250 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 86
Convert GUI app into console app for Win32 Env 5 110
LAN or WAN ? 11 96
Wincontrol not (correctly) drawn 15 42
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

820 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