advwebbrowser get element at mouse position

Hi
I am trying to get the element of a web page at the mouse position.

I am struggling to see how we load the document etc.

Any help appreciated.

Thanks

Hi,

To check if the document is ready, please execute the following code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Timer1.Enabled := True;
  AdvWebBrowser1.URL := 'http://www.tmssoftware.com';
end;
 
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  AdvWebBrowser1.ExecuteJavascript('function test(){return document.readyState}test();',
  procedure(const AValue: string)
  begin
    if LowerCase(StringReplace(AValue, '"', '', [rfReplaceAll]))  = 'complete' then
    begin
      TAdvUtils.Log('document complete for ' + TMSFNCWebBrowser1.URL);
      Timer1.Enabled := False;
    end;
  end
  );
end;

Afterwards, you can execute any code that retrieves the element at mouse positiion. This has to be handled at JavaScript level however.