How to open DevTools with InspectAt?

Having problems with building or using the JCEF Java binding? Ask your questions here.

How to open DevTools with InspectAt?

Postby edominic » Tue Jul 07, 2015 2:03 am

He guys,
another little question.

I added a context menu in my jcef project.
There is an option for opening devtools at current position (like inspect element in chrome).

How do I get the right position in jcef for inspectAt?

Thanks ;)
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: How to open DevTools with InspectAt?

Postby magreenblatt » Tue Jul 07, 2015 10:24 am

How are you displaying the context menu? Do you have an (x,y) coordinate? If so, that's what should be passed to inspectAt.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to open DevTools with InspectAt?

Postby edominic » Wed Jul 08, 2015 1:50 am

I have my window, only with browser-element in it (JFrame window)
contextmenu is handled via
Code: Select all
CefContextMenuHandlerAdapter

I have added an element called "Inspect element" (like in chrome)

In
Code: Select all
onContextMenuCommand
I tried the following options:

getting x/y from cefbrowser argument:
Code: Select all
browser.getUIComponent().getMousePosition()

or getting x/y from params argument:
Code: Select all
new Point(params.getXCoord(), params.getYCoord())


By both, devtools doesn't (or don't? bad grammar :D) point to the right element.
If I navigate to google with browser and open devtools on Google-Logo, it points to body-element of html, not logo-element.

Some advice?

Thanks ;)
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: How to open DevTools with InspectAt?

Postby magreenblatt » Wed Jul 08, 2015 10:36 am

edominic wrote:In
Code: Select all
onContextMenuCommand
I tried the following options:

getting x/y from cefbrowser argument:
Code: Select all
browser.getUIComponent().getMousePosition()

or getting x/y from params argument:
Code: Select all
new Point(params.getXCoord(), params.getYCoord())

Where are the returned coordinates relative to where you actually clicked?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to open DevTools with InspectAt?

Postby edominic » Wed Jul 08, 2015 2:50 pm

With
Code: Select all
new Point(params.getXCoord(), params.getYCoord())

I get the coordinates, where I do the right-click
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: How to open DevTools with InspectAt?

Postby edominic » Mon Jul 13, 2015 12:51 am

Maybe it's an issue? Should I open a ticket?
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: How to open DevTools with InspectAt?

Postby magreenblatt » Mon Jul 13, 2015 10:10 am

edominic wrote:With
Code: Select all
new Point(params.getXCoord(), params.getYCoord())

I get the coordinates, where I do the right-click

What is the (x,y) offset from where you clicked to where the popup menu was displayed? An image would probably be helpful.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to open DevTools with InspectAt?

Postby edominic » Fri Jul 24, 2015 10:27 am

There is no offset, context menu displays where I did right click.
x/y point is right, too
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: How to open DevTools with InspectAt?

Postby magreenblatt » Fri Jul 24, 2015 11:27 am

edominic wrote:There is no offset, context menu displays where I did right click.
x/y point is right, too

Sounds like a bug in that case. Feel free to file a ticket. Include information about your OS platform and reproduction steps using one of the JCEF sample applications.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to open DevTools with InspectAt?

Postby edominic » Mon Jul 27, 2015 5:07 am

edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 126 guests