필터 지우기
필터 지우기

How can I save the content of the MATLAB web browser window programmatically? Not the same as WEBREAD....

조회 수: 6 (최근 30일)
Hello, All.
I am using R2015b on a 64bit Mac running El Capitan.
I have a very specific reason for needing to be able to programmatically save the page source code of a webpage displayed in a MATLAB web browser window. WEBREAD does not work for this specific purpose. Already tested this extensively. Already ruled it out. I am looking for a workaround that draws directly from the browser window and its associated data.
For instance, I know that I can right-click on the MATLAB web browser window and choose "Save As" or "Page Source" to get what I need, but I would like to do this programmatically within MATLAB, not by mouse-click.
Any help would be greatly appreciated.

답변 (1개)

Dave Behera
Dave Behera 2016년 4월 4일
편집: Dave Behera 2016년 8월 10일
Hi,
Are you launching the MATLAB web browser with the 'web' command? http://www.mathworks.com/help/matlab/ref/web.html#inputarg_url
If yes, do this:
[a, h] = web('http://google.com')
CurrentLocation= get(h, 'CurrentLocation') % Gives you location of current page
htmlText = get(h, 'HtmlText') % Gives you html content of current page
  댓글 수: 2
Sean de Wolski
Sean de Wolski 2016년 8월 10일
Add a pause for a few seconds before the htmlText = ... to make sure the web page loads. I think I know your use case :)
Nick Hunter
Nick Hunter 2021년 7월 27일
Hello, there! It says that you are going to remove the handle for the web browser, so Matlab will not allow to do his: [a, h] = web('http://google.com'). Are there any alternative commands to do the same thing? I need HTML information wile the browser is openned as I am doing some authentification. webread() does not work for this =(

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by