I'm trying to get the code layout to work well in the major browsers.
Right now it looks fine in Firefox 2, which is what I mostly use. In IE 6 all the line breaks are removed, I know why but I'm not sure how to fix it. I haven't gotten around to testing other browsers so if things look weird, view it in Firefox and hopefully it'll look better :)
Saturday, March 29, 2008
Thursday, March 27, 2008
Dynamic Finders with Watir
If you've used rails, then you've probably seen the dynamic finders that active record provides. I thought it'd be interesting to see if that kind of behavior could be added to Watir. It turned out to be a nice little exercise.
I'm not sure how it will play in real test code, but I'm going to try it out over the next couple of days.
Here is an example of what you can do:
You can find the source files for the change and the example posted above here. Enjoy!
I'm not sure how it will play in real test code, but I'm going to try it out over the next couple of days.
Here is an example of what you can do:
require 'watir'
require 'dynamic_finder.rb'
include Watir
ie = IE::start_process('www.google.com')
p ie.div_by_id(/gbar/).id # ie.div(:id => /gbar/)
p ie.span_by_class(/gb1/).text # ie.span(:class => /gb1/)
p ie.span_by_class_and_index(/gb1/, 2).text # ie.span(:class => /gb1/, :index=>2)
p ie.span_by_index(2).text # ie.span(:index => 2)
p ie.text_field_by_index(1).name # ie.text_field(:index,1)
ie.text_field_by_name("q").set('watir')
ie.button_by_value('Google Search').click
2.times do
ie.link_by_text(/Watir Tutorial/).click
end
ie.close
You can find the source files for the change and the example posted above here. Enjoy!
Trying Python
I'm gonna give Python a try!!
I've been using Ruby as my scripting language of choice for about 3 years now. It is a great language and I learned a lot using it. However, there are 2 problems that I have with Ruby.
First, its Windows support isn't great. For basic things it works wonders, but when you get beyond that there are a lot of things that Ruby on Windows doesn't do so well. Some of the more interesting gems do not run well (or at all) on Windows. Even some of the standard libraries that ship with Ruby don't work on Windows and don't get me started with some of the core library methods that don't work. It also seems that everything with Ruby runs slower on windows -- very frustrating.
Second, it seems to me that more and more the Ruby community has an attitude that if you aren't running nix then it doesn't matter. This is a real shame, Windows is a huge market. I use Windows for development, most of my clients use Windows so dropping it for a better OS isn't an option. The community as a whole is struggling with this issue but there doesn't seem to be a good solution right now. Check out these (here, here and here) other blogs for some interesting info (the comments are interesting as well).
So I'm gonna try some options and see what is what.
I've been using Ruby as my scripting language of choice for about 3 years now. It is a great language and I learned a lot using it. However, there are 2 problems that I have with Ruby.
First, its Windows support isn't great. For basic things it works wonders, but when you get beyond that there are a lot of things that Ruby on Windows doesn't do so well. Some of the more interesting gems do not run well (or at all) on Windows. Even some of the standard libraries that ship with Ruby don't work on Windows and don't get me started with some of the core library methods that don't work. It also seems that everything with Ruby runs slower on windows -- very frustrating.
Second, it seems to me that more and more the Ruby community has an attitude that if you aren't running nix then it doesn't matter. This is a real shame, Windows is a huge market. I use Windows for development, most of my clients use Windows so dropping it for a better OS isn't an option. The community as a whole is struggling with this issue but there doesn't seem to be a good solution right now. Check out these (here, here and here) other blogs for some interesting info (the comments are interesting as well).
So I'm gonna try some options and see what is what.
Wednesday, March 26, 2008
Teaching
"If you would thoroughly know anything teach it to others." -- Tryon Edwards
If you think you know something, try teaching it. If you think you really know something, try teaching it to a 7 year old, a 10 year old and a 13 year old in the same day!!
If you think you know something, try teaching it. If you think you really know something, try teaching it to a 7 year old, a 10 year old and a 13 year old in the same day!!
Blogging Again
I finally got around to start blogging again. I've lost all my old posts so I'll be starting from scratch...
Subscribe to:
Posts (Atom)