JXBrowser - What is globalX, globalY, windowX, windowY in relation to x, y for forwarding mouse events?

不羁的心 提交于 2019-12-11 15:36:44

问题


I can find no explanation on what these are actually supposed to do.

There are examples on:

https://jxbrowser.support.teamdev.com/support/solutions/articles/9000102480-forwarding-mouse-events

but 629 and 373 ? I can't figure out what those values are for. I can get the same behaviour with any value for those.

What if you one also sets windowX and windowY ?

What would they do to the result click?

I am looking to be able to click and move on a google map. Is that possible?


回答1:


The x and y values define the mouse event coordinate inside the browser content area.

The globalX and globalY values define the screen coordinate of the mouse event.

The windowX and windowY are deprecated. If you set them, this doesn't affect anything.

For more detailed information about working with Google Maps, please take a look at the article.




回答2:


Your browserView must be active/focused first! Then, let's do this way:

public static void simulateMouseClickOnElement(Browser browser, BrowserView browserView, DOMElement element){       
        Rectangle rect = element.getBoundingClientRect();                 
        Point ptOnScreen = new Point(rect.x  , rect.y );         
        SwingUtilities.convertPointToScreen(ptOnScreen, browserView);         
        forwardMouseClickEvent(browser,MouseButtonType.PRIMARY,rect.x,rect.y, ptOnScreen.x, ptOnScreen.y);       
    }

JxBrowser is the BEST automation or crawling/hacking tool! Selenium is a best alternative choice due to the TCO.



来源:https://stackoverflow.com/questions/45800045/jxbrowser-what-is-globalx-globaly-windowx-windowy-in-relation-to-x-y-for-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!