Hi Gsamuk. Look here:
function WB_ClickLink(WB: TWebbrowser; const LinkText: string): Boolean;
var
HTMLDocument2: IHTMLDocument2;
links : IHTMLElementCollection;
Element: IHTMLElement;
href: OleVariant;
I: Integer;
begin
HTMLDocument2 := WB.Document as IHTMLDocument2;
links:= HTMLDocument2.Links;
for I := 0 to links.Length - 1 do
begin
Element:= HTMLDocument2.Links.Item(I, 0) as IHTMLElement;
if AnsiContainsStr(Element.innerText, LinkText) or AnsiContainsStr(Element.getAttribute('href',0), LinkText) then
begin
if AnsiContainsStr(Element.getAttribute('target',0), '_blank') then
WB.Navigate(Element.getAttribute('href',0))
else
Element.Click;
Result:= True;
Break;
end;
end;
Result:= False;
end;