델파이 XE3 TChromium의 구성 요소와 작업을 확인 필요가 페이지의 콘텐츠에 도착은 포럼이 작동 코드의 예를 발견로드 고집 센 DoWork 실행. 잡을 수있는 것은 무엇입니까?델파이 XE3와 TChromium
1
A
답변
1
델파이 7에서 작동하는 tChromium을 얻었습니다. 모두 동일하게 작동해야합니다. https://code.google.com/p/delphichromiumembedded/downloads/detail?name=dcef-r306.7z&can=2&q=
도 XE2 하나가되는 그 변환 많이받지 않을 것, :
나는이 프로젝트에서 래퍼를받은 DOM
처음부터 요소를 읽어 수행 한 단계가있다 XE3, 도움이 필요하시면 기꺼이 도와 드리겠습니다.
procedure DomProc(const Doc: ICefDomDocument);
var
Node: ICefDomNode;
begin
url := Doc.BaseUrl;
if(url='www.goodwebsite.com') then // check if it is the right page and not add
Node := Doc.Body.Document.GetElementById('idofwhatyouarelookingfor');
Node.SetElementAttribute('value','Hello world :D');
end;
내가 가장 신뢰할 수있는 방법이었다
그런
procedure TMainForm.crmLoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer; out Result: Boolean);
begin
if (browser <> nil) and (browser.GetWindowHandle = crm.BrowserHandle) and ((frame = nil) or (frame.IsMain)) then begin
FLoading := False;
// see if loaded
while(httpStatusCode <> 200) do begin
Application.ProcessMessages;
Sleep(50);
end;
browser.GetMainFrame.VisitDomProc(DomProc);
end;
end;
과 같이 domproc라는 프로 시저를 선언하는 시작하고 tchromium
procedure TMainForm.crmLoadStart(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame); begin
if (browser <> nil) and (browser.GetWindowHandle = crm.BrowserHandle) and ((frame = nil) or (frame.IsMain)) then FLoading := True;
end;
에 종료 선언 지금까지 발견 했으니, 당신은 페이지가 잘로드되어 있는지 확인해야하고 당신은 그 igh을위한 dom을 얻고있다. t 프레임.
위의 다운로드 링크에서 예제 코드를 확인하면 도움이 될 것입니다.
Delphi에서 재미있는 코딩을 즐기십시오!
사용중인 Chromium 버전에 따라 다릅니다. 제가 몇 가지 버전에서 기억하는 한, DOM 반복은 전혀 작동하지 않았습니다. – TLama
공식 사이트에서 다운로드 한 최신 버전 – LuckyD
우리는 ['CEF1'] (https://code.google.com/p/delphichromiumembedded/) 래퍼 (['CEF3']가 있기 때문에 (https : //code.google.com/p/dcef3/) wrapper), 그렇다면이 문제에 대한 답을 얻은 것 같습니다 (동일한 일이 CEF3에서 발생합니다.) (https://code.google. com/p/dcef3/issues/detail? id = 10)도 마찬가지입니다. 이전 버전의'CEF1'을 시도해 볼 수도 있습니다 (어떤 것이 최신 버전인지는 알 수 없습니다.이 버전이 작동하는 곳). 그리고 그 버전 이후로 변경된 사항을 확인하십시오. – TLama