matlab web browser position and/or screenshot

Dear Community, I write you to ask if it is possible set or get the position of a current web browser, in order to take a screenshot of a web page, with some app like http://www.mathworks.com/matlabcentral/fileexchange/24323-screencapture-get-a-screen-capture-of-a-figure-frame-or-component or java.awt.Robot.createScreenCapture.
I really think that could pass by the web browser handle: [stat,browser_handle] = web(url);
but I didn't find the right method.
Thank you, Emanuele

Answers (1)

Emanuele - you can try the following which may be applicable to your version of MATLAB. For R2014a on OS X 10.11.6, you can use the methodsview method to view the methods for the browser which is an instance of com.mathworks.mde.webbrowser.WebBrowser.
>> methodsview('com.mathworks.mde.webbrowser.WebBrowser')
or
>> methodsview(browser_handle)
Either of the above will open a window with the methods for this class. The one of interest is getLocationOnScreen which returns a java.awt.Point which seems to represent the position of the top-left corner of the browser window. (You may need to experiment with this though in order to verify that this is exactly what you want.)
You can also use the methods getHeight() and getWidth() to get the height and width respectively of the browser window.

1 Comment

Thank you very much for the help, Yes I've seen those methods but I didn't get that getLocationOnScreen was the top Left corner; I thought that it was the cursor location. I will try soon and let you know thanks, have a nice day

Sign in to comment.

Asked:

on 20 Sep 2016

Commented:

on 21 Sep 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!