5,928
社区成员




procedure TMainForm.AutoLogon;
var
document: IHTMLDocument2;
Element: IHTMLElement;
Anchors: IHTMLElementCollection;
I: Integer;
sLink: string;
begin
sLink := 'http://wenwen.soso.com/z/LLogin.e';
Document := Webbrowser.Document as IHTMLDocument2;
if Assigned(Document) then
begin
Anchors := Document.Get_links;
//遍历所有链接
for i := 0 to Anchors.length - 1 do
begin
Element := Anchors.item(i, varempty) as IHTMLElement;
if Assigned(Element) and (UpperCase((Element as IHTMLAnchorElement).href) = UpperCase(sLink)) then
begin
Element.click;
break;
end;
end;
end;
end;