Solved

Controlling TWebBrowser Page controls ?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

947 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now