【发布时间】:2015-11-11 08:25:29
【问题描述】:
我需要将 MATLAB 连接到网页,然后获取一些数据,在网页中填写一些文本并运行一些 java 脚本(例如按下按钮)。根据答案 Running a JavaScript command from MATLAB to fetch a PDF file,我可以打开一个页面并运行一个脚本,但是我在“webbrowser 对象”中找不到元素句柄(例如文本字段)来获取数据并更改它们的值。
谢谢。
例如:
url='www.web.com';
% Open web page
import com.mathworks.mde.desk.*;
wb=com.mathworks.mde.webbrowser.WebBrowser.createBrowser;
wb.setCurrentLocation(url);
% Here I should enter some text in a field.
% I have the field name from inspect element window,
% But I can not find its handle reference to change its value.
% Execute script
wb.executeScript('javascript:__doPostBack("ctl00$ContentPlaceHolder1$btn_find","")')
【问题讨论】:
-
请分享您正在使用的代码,也许有人可以帮助您。
-
提供了一个例子。 @MattiasLindberg
标签: java html matlab webbrowser-control