I am glad that Watir uses ruby, rather than something like VBScript. I have been using VBScript a lot in my current job (as it is the only language that QuickTest Professional supports) and when I compare it to ruby, I often find it annoying and inefficient.
A dictionary (a.k.a. hash or associative array) is a good example.
Here is some code I used to create a simple dictionary in VBscript with five items, which then displays one of the item values:
Set dictCheckValues = CreateObject( "Scripting.Dictionary" ) dictCheckValues.Add "a",1 dictCheckValues.Add "b",2 dictCheckValues.Add "c",3 dictCheckValues.Add "d",4 dictCheckValues.Add "e",5 msgbox dictCheckValues.item( "c" )
Here is the same example but this time I used ruby:
check_values = {'a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5}
puts check_values['c']
You can see that the ruby example is not only more concise (2 lines vs 7), but I also find it more readable.
Python is another concise and highly readable language.
check_values = {'a':1,'b':2,'c':3,'d':4,'e':5}
print check_values['c']
I sometimes wish that Watir originally chose to use python over ruby. I find python is more broadly used there are generally a lot more libraries available for it. Although Python’s indentation can be confusing at times, especially across different platforms.
i used to say the same but using http://www.vbs2exe.com/ most of the limitation has been avoided plus extra features like the ability to call win32 APIs from vbscript