Subscribe Bookmark RSS Feed

Read and parse the content of web browser box

peri_a

Community Trekker

Joined:

Aug 18, 2015

as a part of a larger customized JMP application, I have a JMP script that opens a window with a web browser box that calls an interactive website.

After a few user clicks and the submission of a Form, the resulting (dynamic) webpage is loaded and the needed data are available. (there is no AJAX or similar so the plain HTML of the webpage contains all i need) but unfortunately i cannotot find a way to read and parse the HTML of the "current web browser content".

I cannot work around it with the "open function" as i cannot access the results webpage directly with a URL. The right page is loaded only after a form is submitted with POST method and a file uploaded on the server via the original webpage form.

I have no control over customizing this server application and i need to work parsing the final HTML.

At the moment i display the results in the web browser but I need to do further actions in JMP afterwards.

If not directly fiddling around with HTML i would like at the minimum to create a Journal or something that allow me to use the web browser content in a larger report that can store results in a JMP readable format without the need to re-execute the server routine

Thanks

3 REPLIES
msharp

Super User

Joined:

Jul 28, 2015

I've had similar issues.  From what I can tell the web browser box is really more for display than for interaction.

JMP has capabilities to interact with the web, I'd suggest creating a JMP GUI that's identical to what the user would see on the web.  Use the information to create a text file or something that you can then use to do what you need to do.

peri_a

Community Trekker

Joined:

Aug 18, 2015

msharp, Thanks for your answer, would you know a way JMP can send an HTTP request in POST with an attached file into it without the browser box?

If so how it stores the server response?

msharp

Super User

Joined:

Jul 28, 2015

If the website is using a HTTP GET or HTTP REQUEST you could just append the information at the end of the URL for example: URL?name1=value1&name2=value2

​This method is way easier but I'm assuming this isn't the case b/c you directly said it was a HTTP POST.  Using JMP you're going to need to use the socket functions. Something like:


tCall << connect( "URL", "80" );  //Open connection, 80 is socket and URL is self-explanatory

tCall << Send( Char To Blob( "POST / HTTP/1.0~0d~0a~0d~0a", "ASCII~HEX" ) ); //what you send

tMessage = tCall << Recv( 1000 ); //what you get back

text = Blob To Char( tMessage[3] ); //parse

Show( text );

tCall << Close( ); //close connection

Without more information this is the most I can help you with.  Using these commands can get muddy, but you can use the Scripting Guide section "Using Sockets in JSL" for more information.