Autoit · Ruby

How to install/register AutoItX3.dll ?

Steps to install/register AutoItx3.dll file in windows machine:

1. Download AutoItX3.dll file from the link http://www.2shared.com/file/6zR7bTlq/AutoItX3.html

2. After download completes, Copy & paste it in c:\autoit\PASTE HERE (c:\autoit\AutoItX3.dll)

3. Open Command Prompt as an ‘Adminstrator’

4. In Command Prompt>cd c:\windows\systems32 [Press Enter]

5. c:\windows\systems32>regsvr32 c:\autoit\AutoItX3.dll [Press Enter]

6. Prompt will appear with message “registration Succeeded”

pdf · QA · Ruby · watir-webdriver

Convert web page(using Watir-Webdriver) to PDF File (Its my 150th post :) )

Question/Requirement:

1. I just navigated to the webpage “http://humblelittlerubybook.com/book/hlrb.pdf”

2. I want to Save the web page as a PDF File.

Solution:

1. Install Ruby

2. Install Watir-webdriver (CMD>gem install watir-webdriver)

3. Register Autoitx3.dll (https://raveendran.wordpress.com/2012/06/15/how-to-installregister-autoitx3-dll/)

4. Run the Below Script

Code:

require 'rubygems'
require 'watir-webdriver'
require 'win32ole'

ie=Watir::Browser.new :ie
ie.goto(“http://humblelittlerubybook.com/book/hlrb.pdf”)

sleep 15
$autoit = WIN32OLE.new(“AutoItX3.Control”)

$autoit.Send(“{ALTDOWN}”)
sleep 3
$autoit.Send(“f”)
sleep 3
$autoit.Send(“{ALTUP}”)
sleep 3

$autoit.Send(“{DOWN}”)
sleep 3
$autoit.Send(“{DOWN}”)
sleep 1
$autoit.Send(“{DOWN}”)
sleep 1
$autoit.Send(“{DOWN}”)
sleep 1
$autoit.Send(“{DOWN}”)
sleep 1
$autoit.Send(“{DOWN}”)
sleep 1
$autoit.Send(“{ENTER}”)
sleep 10
$autoit.Send(“D:\\test1.pdf”)
sleep 3
$autoit.Send(“{TAB}”)
sleep 1
$autoit.Send(“{TAB}”)
sleep 1
$autoit.Send(“{ENTER}”)
sleep 1

Note:

1. Depends upon your browser you may need to add/remove the {TAB} and {DOWN}  lines

2. Change the destination folder.

Output:

PDF file saved in the mentioned location D:\\test1.pdf