필터 지우기
필터 지우기

clicking on a link in matlab browser without using the mouse

조회 수: 3 (최근 30일)
AA
AA 2016년 6월 24일
답변: Walter Roberson 2016년 6월 25일
assume the following code
url = 'http://www.google.com';
>> web(url)
How can I access the gmail link in that website without using the mouse. Is there a away in matlab?

답변 (2개)

Geoff Hayes
Geoff Hayes 2016년 6월 25일
AA - please clarify why you want to do this. Why not go directly to the gmail link and bypass the above?
I suppose that you could read the URL content and look for the link that you are interested in, namely the one for Gmail, which will be of the format
<a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a>
The code to extract the URL for Gmail would then be
url = 'http://www.google.com';
urlContent = urlread(url);
gmailIdx = regexpi(urlContent,'Gmail');
hrefIdx = regexpi(urlContent(1:gmailIdx),'href=');
gmailURL = urlContent(hrefIdx(end)+6:gmailIdx-3);
web(gmailURL);
Of course, the big assumption is that the format for the Gmail link is described as above.

Walter Roberson
Walter Roberson 2016년 6월 25일
Java Robot class.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by