-
- '; Don't pass positioning ID, class and & lt; Li> , and use language for each site is different, such as: locate the next chapter, after obtaining href address
CodePudding user response:
Procedure TForm1. Wb1StatusTextChange (ASender: TObject; Const Text: WideString);//to get open the hyperlink to the current page.
The begin
Mmo2. Lines. The Add (TimeToStr (Now ()) + ': open the hyperlink URL: + Text);
end;
This can point to a page of text hyperlinks, but it is not what I want, I want to get hyperlinks through text box
CodePudding user response:
Webbrows add and run their own JS, by JS to find a label, then judgment is needed to get the href attribute values,CodePudding user response:
Sorry, check the case of a lot of information and Internet, can't positioning, rewrite the, run to Element. The getAttribute () 'href' error,Doc:=wb1. Document as IHTMLDocument2;
Mmo1. Lines. The Clear;
Mmo2. Lines. The Clear;
Wb1. Navigate (x);
If wb1. Busy or (wb1. ReadyState<> READYSTATE_COMPLETE) then the Exit;//in the page load, exit,
If Assigned (Doc) then
The begin
Anchors:=Doc. Get_links;//to iterate through all links
For I:=0 to Anchors. Do length - 1
The begin
Element:=Anchors. The item (I, varempty) as IHTMLElement;//find specify links
//if Assigned (Element) and (UpperCase ((Element as IHTMLAnchorElement). Href=UpperCase (x)) then
K:=Element. The innerText;
If k=' 'in the previous chapter then
The begin
H:=Element. The getAttribute (' href ');
Mmo1. Lines. The Add (h);
end;
Break;
end; }
end;
end;