I have been plagued some time now with a problem in my Selenium testing, the dreaded modal Javascript alert generated from the "onload" event (See the Selenium FAQ for more info). OK, maybe dreaded is a bit strong of a word, but it has been quite frustrating in trying to automate vendor provided code that we cannot change. Finally there is a fix.
Jason Huggins, the creator of Selenium, presented at JSConf 2009 and demonstrated a way around Javascript alerts that Selenium cannot handle. After speaking with Jason, he provided me with the original code snippet from Aaron Boodman and I have created a Firefox extension for general use that can be downloaded from my Github site.
The magic happens in a function called alertClose. If all you need to do is close an alert it should work unmodified for you. If you need to do something a little more exotic you may need to edit the subject.location which specifies what types of windows it closes. By default it points to chrome://global/content/commonDialog.xul, which is the chrome type for alert boxes. There is a Mozillazine article that has a listing of the various types of chrome windows if you need to customize.
So there you have it. A very simple way to get around Javascript alerts. Hopefully this solution is only temporary and the new WebDriver code being integrated into Selenium 2 will work around it in a more elegant way.
Tuesday, February 2, 2010
Thursday, December 10, 2009
Converting from Soap4r to Handsoap
A neat little project was mentioned to me the other day in a conversation on GitHub with user JRun. It's called Handsoap and it has some very interesting features that look to make programming SOAP clients a bit easier. I've had a couple days to look at it and decided to try and port some code to it. My first impressions have been fairly positive. It gives you tremendous power on how you handle your SOAP requests and responses, but I find it just as cumbersome as Soap4r in it's handling of complex types. I think Soap4r might gain out in this category just by the shear amount of code that gets generated for you. That said, Handsoap is fast, simple and I will probably use it in future projects that require SOAP.
One thing I did find much easier to deal with is SOAP headers. In Soap4r I had to create an entire class just to add an element to the SOAP header. This was required for my Viewpoint project to add the RequestServerVersion element to the header. With Handsoap all I had to do was add the following to the 'on_create_document' hook:
If you have programmed with Soap4r before I would encourage you to give Handsoap a try.
One thing I did find much easier to deal with is SOAP headers. In Soap4r I had to create an entire class just to add an element to the SOAP header. This was required for my Viewpoint project to add the RequestServerVersion element to the header. With Handsoap all I had to do was add the following to the 'on_create_document' hook:
header = doc.find('Header')
header.add('t:RequestServerVersion') {|rsv|
rsv.set_attr('Version','Exchange2007_SP1')
}
If you have programmed with Soap4r before I would encourage you to give Handsoap a try.
Convert your Exchange Calendar to iCalendar with Ruby
This example is one that is already in the README, but I thought I'd post it here anyway. The reasons for converting an Exchange calendar to ical may be many so I won't surmise why you want to do this. I for one use it to export out to my Orage calendar.
So without further ado ...
So without further ado ...
Tuesday, December 8, 2009
Viewpoint Examples Forthcoming
I recently started writing a library in Ruby that utilizes the Microsoft Exchange Web Service (EWS) to perform some rudimentary tasks. I was asked by a couple people to provide more examples on how to use the library. I will be doing so in upcomming blogs. In the meantime you can look at the library for yourself here:
http://github.com/zenchild/Viewpoint
It is also available via a gem:
gem install viewpoint
There is a bug tracker on Github. If you have any issues please open a ticket.
Have fun and let me know how you are using it.
http://github.com/zenchild/Viewpoint
It is also available via a gem:
gem install viewpoint
There is a bug tracker on Github. If you have any issues please open a ticket.
Have fun and let me know how you are using it.
Subscribe to:
Posts (Atom)
