A Very Poor Man's Vonage Web Service using Watir
Folks keep calling after 9pm and waking the baby. We use Vonage, and I really wish they had a feature where I could indicate "do not call" times. Alas, they don't. So, then I wished for a Vonage Web Service. Nope.
So, instead here's a Watir script, recorded with a early version of Michael Kelly and John Hann's port of WatirMaker to Ruby (via "ruby watirmaker.rb > myscript.rb") then edited to taste.
#Enable Instant Forward to Voice Mail
require 'watir'
include Watirie = IE.new
ie.goto( 'http://www.vonage.com/' )ie.text_field( :name, 'username' ).set( 'username' )
ie.text_field( :name, 'password' ).set( 'password' )
ie.button( :name, 'submit' ).clickie.link(:text,"Features").click
ie.button( :name, 'callForwardingButton' ).click
ie.select_list( :name, 'callForwardingSeconds' ).select( 'Instantly' )
ie.text_field( :name, 'singleAddress' ).set( '15035551234' )ie.button(:value,'Enable').click
ie.link(:text,"Log Out").click
ie.close
And the disable...
require 'watir'
include Watirie = IE.new
ie.goto( 'http://www.vonage.com/' )ie.text_field( :name, 'username' ).set( 'username')
ie.text_field( :name, 'password' ).set( 'password' )
ie.button( :name, 'submit' ).clickie.link(:text,"Features").click
ie.button( :name, 'callForwardingButton' ).click
ie.button(:value,'Disable').click
ie.link(:text,"Log Out").click
ie.close
These now run on a schedule in my house using the Windows Scheduler. If you run them like 'ruby enable.rb -b' they run in the background and you'll never see Internet Explorer.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
This is one of those times where I just had to slap my head and think "Why in the hell didn't I think of that?"
Thanks, Scott. I'll be putting this one to good use.
you may want to give yourself a 5 minute latency, as I doubt the change is real time.
Sat
Hard to believe Vonage hasn't implemented this yet. Nice workaround, though.
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:1928:in `assert_exists': U
nable to locate object, using name and callForwardingButton (Watir::Exception::U
nknownObjectException)
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:2009:in `clic
k'
from C:/Documents and Settings/Tim/Desktop/test2.rb:24
Is there?
I do know that on Firefox the Enable button is named "Save Changes." Vonage is doing some kind of sniffing.
I was running it on my laptop downstairs (older box runnin win2k), and I don't think I tried it on the computer upstairs (MCE2k5). Would the version of IE make a difference? I'll try to play with it some more tonight. On the computer upstairs as well as my work laptop. I can't play with it here as our admins are a bunch of nazis and have vonage websensed.
ie.link(:text,"Features").click
the recorded script wound up with
ie.document.all[ '85' ].click
They both go through to the features page, but when it used the document.all method, it couldn't find the callForwardingButton.
Either way, it works now. Thanks!
(For the record, I started with your script, but didn't have watir installed right, so I gave up on that initially. I wanted to automate something slightly different, so I recorded my own.)
Comments are closed.
Thanks, Scott.