<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UNIXy &#187; automate</title>
	<atom:link href="http://blog.unixy.net/tag/automate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unixy.net</link>
	<description>Fully Managed Dedicated Servers</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:37:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Script To Automate Browsing Actions Using Lynx</title>
		<link>http://blog.unixy.net/2009/06/script-to-automate-browsing-actions-using-lynx/</link>
		<comments>http://blog.unixy.net/2009/06/script-to-automate-browsing-actions-using-lynx/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 00:47:52 +0000</pubDate>
		<dc:creator>UNIXy</dc:creator>
				<category><![CDATA[Crash Course]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[automate Links]]></category>
		<category><![CDATA[automate Lynx]]></category>
		<category><![CDATA[browser actions]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[Lynx]]></category>

		<guid isPermaLink="false">http://blog.unixy.net/?p=14</guid>
		<description><![CDATA[There are times when one needs to automate some of the mundate tasks associated with browsing a certain Web page or accomplishing a certain interactive task online. If the task is repetitive, then there has to be a way to automate it using a computer! Browser tasks are no exception. In this brief guide I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F06%2Fscript-to-automate-browsing-actions-using-lynx%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.unixy.net%2F2009%2F06%2Fscript-to-automate-browsing-actions-using-lynx%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There are times when one needs to automate some of the mundate tasks associated with browsing a certain Web page or accomplishing a certain interactive task online. If the task is repetitive, then there has to be a way to automate it using a computer! Browser tasks are no exception. In this brief guide I&#8217;m going to show you how to automate some browsing actions on a website called <a title="Fully Managed Virtual Private Servers" href="http://www.vpslux.com" target="_blank">http://www.vpslux.com</a>. More specifically, I&#8217;m going to show you how to automate browsing a page called &#8220;explained.&#8221; Keep in mind that the action could be anything from authenticating to uploading a file!</p>
<p>Lynx is a text browser that runs from the command line, which is also known as &#8220;shell.&#8221; It runs on most operating systems notably Linux. It comes with a valuable feature that will help us automate actions that are normally performed interactively via a browser (Ex: Firefox, Safari, or Internet Explorer). The two most important features in our case are command logging and command scripting. Per the manual of Lynx:</p>
<blockquote><p>-cmd_log=FILENAME<br />
write keystroke commands and related information to the specified file.</p>
<p>-cmd_script=FILENAME<br />
read keystroke commands from the specified file.  You can use the data written using the  -cmd_log  option.</p></blockquote>
<p>Let&#8217;s record our actions by browsing <a title="Fully Managed Virtual Private Servers" href="http://www.vpslux.com" target="_blank">http://www.vpslux.com</a> using Lynx. From the command line or shell, launch Lynx with the following arguments and flags:</p>
<blockquote><p>lynx -cmd_log=/tmp/www.vpslux.com http://www.vpslux.com</p></blockquote>
<p>The above command will not only take me to the Website in question but also record every keystroke and action I perform and save it inside the file /tmp/www.vpslux.com. It is so simple and so powerful at the same time. Once I&#8217;m done with navigating to page &#8220;explained&#8221; by clicking on the &#8220;VPS Explained&#8221; located at the top of the first page (<a title="What does a slice of pizza and VPS have in common?" href="http://www.vpslux.com/?page=explained" target="_blank">http://www.vpslux.com/?page=explained</a>), I hit the letter &#8216;q&#8217; on my keyboard to exit from Lynx. Inspect the file /tmp/www.vpslux.com to make sure all actions have been recorded. You should see something similar to this depending on the actions you have performed (I cut down quite a bit to keep it short):</p>
<blockquote><p># Command logfile created by Lynx 2.8.6rel.4 (15 Nov 2006)<br />
# Arg0 = lynx<br />
# Arg1 = -cmd_log=/tmp/vpslux.com<br />
# Arg2 = http://vpslux.com<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key ^J<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow<br />
key Down Arrow</p></blockquote>
<p>The hard part is done! All we need to do now is create a small script that will use our www.vpslux.com file as the source or script. You could create a small Bash script called browseWeb.sh with the following content:</p>
<blockquote><p>#!/bin/bash</p>
<p>lynx -cmd_script=/tmp/www.vpslux.com http://www.vpslux.com/</p></blockquote>
<p>An extra step would to create a crontab entry to run the above script say every Monday morning at 4am:</p>
<p>crontab -e</p>
<p>0 4 * * 1 /home/user/browseWeb.sh</p>
<p>That&#8217;s all folks. I hope this is useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.unixy.net/2009/06/script-to-automate-browsing-actions-using-lynx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

