Page 1 of 1

Extract Data From Webpage

Posted: Mon Apr 20, 2009 4:49 pm
by warrenk
I need to extract the values from a dropdown box on a webpage and load them into a dropdown field in Rev Studio. Is this possible with Rev Studio?

Thanks for any help!
Warren

Extract Data From Webpage

Posted: Tue Apr 21, 2009 5:50 am
by dickey
Hello Warren, I am new to Revolution Studio, but nonetheless there are several ways this task can be achieved in conjunction with Rev Studio.

1. the first question to ask of the solution is whether the <select></select> or drop list on the web site is populated with fixed options? - like:

Code: Select all

<html>
  <body>
    <form id="eg_form" action="eg_action.html" method="post">
      <select id="eg_select" name="">
        <!-- commonly selects start with a blank option -->
        <option id="0"></option>
        <option id="1">Red</option>
        <option id="2">Green</option>
        <option id="3">Blue</option>
      </select>
    </form>
   </body>
</html> <!-- etc etc -->
, or is the <select> populated with options that are the result of a dynamic process on the web page, such as being assigned based on the value in another <select> or <input> control, or are they perhaps database driven (an sql record set).

Your solution may therefore differ in each case, due to the nature of the way the <select> is updated on the web page. You may need to grab the options on opening your application (seldomly) or perhaps need to get the options live as you load a stack/substack/ or card as part of a transaction/program workflow (on call).

Fixed Options Scenario:

1. visit the target in your web browser and view source.
2. find the id of the element <select> you wish to target (write it down).
3. use the revBrowserGet command - see the documentation for the "htmltext" option, which extracts the
The html source of the current page being displayed.
4. write some code to handle the text, extracting either the id or option text between the <select id="your target id" and closing </select> tag.

Warren, if that scenario sounds like yours, that solution will work. If you need to obtain options from a dynamic page, I will post the second solution on request.

I hope you find this information helpful.

Kind regards, Andrew

Posted: Tue Apr 21, 2009 11:51 am
by warrenk
Andrew,

I really appreciate the time in explaining the process. I really appreciate your help. This is perfect!!! :D

Have a great day!
Warren

Extract Data From Webpage

Posted: Tue Apr 21, 2009 2:20 pm
by dickey
Thanks for your kind words Warren - I am just pleased I could help.

Kind regards, Andrew