How to get data under mouse pointer?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to get data under mouse pointer?

Postby meister3535 » Wed Aug 26, 2020 9:57 am

There is a website which has profile photos, i want to get href profile link when i move mouse point on one of that profile photos. There is already method for do that with basic c# webbrowser but CEF doesn't support that .https://stackoverflow.com/questions/4207003/c-sharp-webbrowser-control-how-to-get-data-under-mouse-pointer
Seems like i need to do that by JavaScript and execute it by EvaluateScriptAsync but honestly i don't have enough knownladge about JS.

I've found https://stackoverflow.com/questions/8813051/determine-which-element-the-mouse-pointer-is-on-top-of-in-javascript
All i need to do is just
Code: Select all
  const string script = @"(function(e)
                {
         var x = e.clientX, y = e.clientY,
        elementMouseIsOver = document.elementFromPoint(x, y);
return  elementMouseIsOver;
})();";
                browser.EvaluateScriptAsync(script).ContinueWith(x =>
                {
                    var response = x.Result;


                    if (response.Success && response.Result != null)
                    {
                        MessageBox.Show("okey");
                    }
                });

But i got
Code: Select all
[0826/184733.022:INFO:CONSOLE(1)] "[bugsnag] Ignoring cross-domain or eval script error. See docs: https://tinyurl.com/yy3rn63z", source: https://app.tandem.net/_next/static/chunks/bed339dcc5b6a6f8ee4da828fdcf75864c6e5c8c.65bc411a200287b1c573.js (1)
[0826/184733.022:INFO:CONSOLE(3)] "Uncaught TypeError: Cannot read property 'clientX' of undefined", source: about:blank (3)
theese output. Seem like it ClientX is unknown.


Also i've tried to inject that JS into website by Chrome ext. it doesn't give me href link, it just returns me
Code: Select all
[object HTMLImageElement]
seems like it's only returns object, not "https:" part..
meister3535
Newbie
 
Posts: 1
Joined: Wed Aug 26, 2020 9:39 am

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 96 guests