Skip Navigation Links
 Product InformationExpand  Product Information
Getting StartedExpand Getting Started
DownloadsExpand Downloads
LicensingExpand Licensing
Support & FeedbackExpand Support & Feedback
ServicesExpand Services
About UsExpand About Us
  
 Welcome to SmartsAutoWeb
Your first SmartsAutoWeb Project - A simple example

Here we'll set up a simple test project that automates the retrieval of the first 10 URLs matching a search term in Google. For the purposes of this demonstration we will just display each URL in a MessageBox, though in practice we may want to add the URLs to a record-set and return it.

Step 1 : Create a New Project

Select the New Project item from the File menu, and enter 'TestProject' as the name and 'www.google.com' as the URL. Click OK. SmartsAutoWeb will navigate to www.google.com.





Step 2: Create a variable to receive the search term parameter.

Go to the Manage Variables item in the Project menu. Click the 'Add Variable' link. Enter 'SearchTerm' as the name. Enter 'vegetables' as the default value (this will be useful for testing). Click OK.



Step 3: Create a variable to receive the URL.

We need a variable to use for reading from the web page.  Click the 'Add Variable' link. Enter 'URL' as the name. Click OK. Click OK to exit the Manage Variables form.



Step 4: Click on the Google search box to select it.

The box should be highlighted, and a Select Element Action will be created for you.



Step 5: Write the SearchTerm parameter to the selected search box.

Click on the Write Value toolbar button. A Write Value Action is created, and its' property page is displayed. Click the 'Use Variables' link underneath the 'Write Value' textbox, and select variable 'SearchTerm' from the dropdown list presented.





Step 6: Click on the 'Google Search' button to select it.

The box should be highlighted, and a Select Element Action will be created for you.



Step 7: Add a Click action.

Click on the 'Click' toolbar button to execute the click. Search results for vegetables should be displayed.





Step 8: Select the title of the first search result.

It should be highlighted. Note that you may need to click twice in quick succession to select the whole title, though in this case it doesn't really matter. (Clicking multiple times selects a larger area)



Step 9: Expand the selection to multiple elements.

Drop down the 'Selection Type' combo, and select 'Multiple elements'. You will be notified of the need to click the End button when you have finished defining Actions for each selected element. All titles on the page should now be selected.



The default settings are not appropriate, since Google can format results unpredictably.  Hence we'll uncheck the reliance on hierarchical location, and instead select the style option.  This means we are searching for matches based on how the items appear, as opposed to where they are physically on the page.



Step 10: Add a Read Value Action to read each URL.


Click on the Read Value toolbar button. A Read Value Action is created, and its' property page is displayed. Select the href property and the URL variable from the dropdowns. (The href property of a hyperlink is the URL of the linked page).



Step 11: Add a Prompt action to display each URL.

Click the 'Other Actions' button on the toolbar (or the 'Add Action' button or menu item). Select a 'Prompt for Confirmation' Action. Click the 'Use Variable...' link on the properties page and then select the URL variable, such that the prompt displays the URL which was just read.  Click OK to insert the variable into the prompt..





Step 12: End the selection looping.

Click the End Multi-Select button (under the Actions list).





Step 13: Configuring the parameter.

Go to Project Settings from the Project menu. On the Parameters tab, check SearchTerm as a parameter.



Testing :

Select Run from the Test menu. You should be prompted for a search term. On entering this, up to 10 related URLs should be displayed (or more if you have configured Google to return more than 10 results per page by default).

Extending :

You may want to add support for the link to the next page of search results. To do this, you would select the Next page link at the end of the project to add a Select Element Action, and then add a Click Action. Then add a Goto Action to go back to the Select Action created at Step 8. Add exception handling (via the exception handling tab) to the Select Element item added for the next link, and set it to end execution. That way, when the next link is no longer present (because we have exhausted the search results), execution will stop.

You should add similar exception handling to the Select Element Action created at step 8 to cover the case where there are no search results.
 
 Half price licensing
Get SmartsAutoWeb licenses for half price! - limited time offer 

Yes, you heard right, that's just $99 (£50, 79 EURO) for SmartsAutoWeb Standard Edition, normal price $199 (£100, 159 EURO).  Buy now before this great offer ends.