-2

I need to connect MATLAB to a webpage then get some data, fill some text in webpage and run some java scripts (e.g. pushing a button). Based on answer in Running a JavaScript command from MATLAB to fetch a PDF file, I can open a page and run a script but I can not find elements handle (e.g. a text field) in "webbrowser object" to get data and changes their values.

Thank you.

For example:

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","")')
Community
  • 1
  • 1
JetSonic
  • 103
  • 1
  • 7

1 Answers1

0

Finally, I did not find a solution with this approach, but I found the solution using com server:

oIE = actxserver('internetexplorer.application');
oIE.Navigate('http://www.page.com/');
oH=oDoc.getElementById('IDName');
set(oH,'value','Test')
JetSonic
  • 103
  • 1
  • 7