SendMouseClickEvent and OnLoadingStateChange

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.

SendMouseClickEvent and OnLoadingStateChange

Postby mhoran » Wed Feb 10, 2016 10:13 pm

I'm in the process of porting a headless browser testing tool from QtWebKit to CEF.

One of the tasks we perform in this tool is mouse clicks. We currently use "native" clicks to emulate real user interaction. We favor this approach over JavaScript events for a number of reasons, which I won't get into here. I've got a working implementation, but I have some questions about the "round-trip" associated with a mouse click and any associated page load.

From my investigation, it seems that a click sent via CefBrowser::SendMouseClickEvent (I'm actually using the C API, but I'll do my best to translate to C++ methods for readability) goes from the browser process to the render process, is handled by any associated JavaScript callbacks, triggers CefRenderProcessHandler::OnBeforeNavigation, before winding up back in the browser process, triggering CefLoadHandler::OnLoadingStateChange.

I need to "block" the response to a "Click" request on any potential page load. This is the contract of the API I'm integrating with. I've done this by sending a number of IPC messages between the browser and render process, in the hopes that I "follow" the underlying events that are handling the request.

I'm looking for anyone to call out any issues with my approach, or point me at a better mechanism to determine 1) if a click has been "ACK'd" by the render process, and 2) if a click resulted in a page load. You can find my attempt at an implementation on GitHub: https://github.com/mhoran/capybara-chromium/commit/84ca5c335fdd50a9df2003b98b28e521c3019998.
mhoran
Newbie
 
Posts: 1
Joined: Sat Feb 06, 2016 3:39 pm

Return to Support Forum

Who is online

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