Scrape Table
(→Example) |
(→Example) |
||
Line 8: | Line 8: | ||
== Example == | == Example == | ||
+ | |||
<pre>navigate("http://www.w3schools.com/html/html_tables.asp", "Wait") | <pre>navigate("http://www.w3schools.com/html/html_tables.asp", "Wait") | ||
scrape table(<innertext="Apples">, &my table) | scrape table(<innertext="Apples">, &my table) | ||
</pre> | </pre> | ||
+ | |||
[[File:scrapetable.png]] | [[File:scrapetable.png]] | ||
Line 24: | Line 26: | ||
save to file("C:\\Users\\Desktop\\mytable.csv", &my table) | save to file("C:\\Users\\Desktop\\mytable.csv", &my table) | ||
</pre> | </pre> | ||
+ | |||
[[File:scrape table.jpg]] | [[File:scrape table.jpg]] | ||
+ | |||
For the example script above, browse for an .txt or .csv file you can save the table contents to. | For the example script above, browse for an .txt or .csv file you can save the table contents to. | ||
Make sure your table is populated before attempting to save to the file. | Make sure your table is populated before attempting to save to the file. |
Revision as of 12:25, 15 May 2013
This command is part of the Browser Command for the Professional Edition. Scrape Table scrapes an html table element into a UBot table.
Simply drag this command into the scripting area and choose an item within the table using the element selector option. (See The Selectors for more information)
Table Element: An item selected from the targeted table for scraping.
Table: The UBot table the scraped table should be saved to.
Example
navigate("http://www.w3schools.com/html/html_tables.asp", "Wait") scrape table(<innertext="Apples">, &my table)
Running the script will cause the browser to navigate to the specified website and scrape the table on the website to a ubot table.
To save the table to a .csv file, simple insert the table into the Save to File command.
save to file("C:\\Users\\Desktop\\mytable.csv", &my table)
For the example script above, browse for an .txt or .csv file you can save the table contents to.
Make sure your table is populated before attempting to save to the file.