Hello,
Zitat:
I have a problem. Does anyone have any idea how to click an image button with no id or tags in TWebBrowser?
I don' t know whether this particular button becomes unique by the attributes classname and tabIndex; if so you could try it this way:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
d : IHTMLDocument3;
c : IHTMLElementCollection;
i : Integer;
e : IHTMLElement;
s :
string;
begin
d := WebBrowser1.Document
as IHTMLDocument3;
if not Assigned (d)
then
Exit;
c := d.getElementsByTagName ('
button');
for i := 0
to c.length - 1
do
begin
e := c.item (i, EmptyParam)
as IHTMLElement;
if not Assigned (e)
then
Exception.Create ('
Your message');
if e.className = '
x-btn-text'
then
begin
s := e.getAttribute ('
tabIndex', 0);
if s = '
0'
then
e.click
end
end
end;
Best regards