Search code examples
jxbrowser

JXBrowser - Any way to right click + inspect or dev tools?


I am asking because if you are coding and testing against JX generated browser, and say you want to inspect elements to add to the code, or inspect a button to see a link, you shouldn't have to open up another browser, follow the same clicks to do that.

Is there a way to enable a full browser window? Including all functionalities of a normal browser? Address field and so on??

            Browser browser = jx.browser;

            BrowserView browserView = new BrowserView(browser);

            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.add(browserView, BorderLayout.CENTER);
            frame.setSize(1024, 768);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);

            browser.loadUrl("http://www.google.com");

Solution

  • If you would like to inspect HTML elements on the loaded web page anytime, then I recommend that you run your application with the --remote-debugging-port Chromium switcher every time. You can read more about this switcher at https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013082-remote-debugging-port

    JxBrowser doesn't provide "full" browser window with tabs, address bar, etc. JxBrowser is just a component/library, not an entire desktop application. Using this library you can build your entire desktop application with tabs, address bar, etc.