When trying to figure out which to use between the two most popular web automation tools Watin & Selenium, I chose Watin as it was simple to start with at the time (a few years back) and worked great with C# and visual studio on windows.
Then my automation needs grew, and I needed to upload files into forms and with the new versions of IE I found out that I will have to use Firefox as IE has a permission/security problem automating the upload dialogs.
Firefox requires the jssh addon for receiving automation commands, which was OK at the time.
Jssh addon exists for Firefox up to version 3.6, but with the latest version race Mozilla took, Firefox is now up to version 6 and there is no compatible jssh plugin for it.
So, what options do we have ? it seems there are two :
1) remove your FF 6 and install the latest 3.6.X
2) use a VM with FF 3.6.X installed on it
There is another option:
3) Installing a portable FF version alongside the system FF 6 (you will still need to add the jssh add on to the portable version but that is not a problem).
The problem with this is that you will need to use the FireFox.PathToExe method and set it to the path of the portable firefox version (including the file name). But your problems won't end here, you will need to recompile Watin from the sources and do some changes too.
After doing all the above for solution #3, I still had exceptions from Watin, so I went back to option #1 (even though, as you will soon see below I could have stayed with option 3 and used the same fix for the exceptions too)
So back to option #1.
Still got an exception, and now in Process.HasExited inside the Watin library.
Didn't quit, compiled watin in debug and searched the internet - turns out Process.HasExited throws an exception when it is accessed from a non-privileged process (this pertains to Vista and Windows 7 which have the UAC feature on). Thanks Microsoft for not giving me just a 'process has no privilege' exception with a pointer to UAC :/ ) instead you get an Access Denied ...
So you need to run the process with 'run as an administrator' - then it worked !
But wait, I want to run it in visual studio in debug, but that doesn't work because it doesn't run it as administrator..., so you need to run visual studio itself has 'run as administrator' to causs all debug sessions to be run with the same privileges.
Everything seems to work now, except for my application hanging for a lot of time in different locations so that I see as if the Watin flow is very slow and sometimes seems to stop for several minutes before selecting radio buttons and clicking buttons onthe web page. So i ran it in debug and just pressed 'pause' in visual studio each time I saw it hang and not progress with running the web automation.
To my surprise I found out the problem with the watin program running very slow and sometimes just hanging was in my code when i called a logging function that updated a RichTextBox with new text that says what phase has been done between watin operations:
private void LogPrint(string str)
{
logTextBox.AppendText(logTextBox.Text + str + "\n");
}
I have no idea why this happens (some race condition between wating and GUI threads with waitformultipleobjects() maybe ??? i don't know, i am just happy that after commenting it out the logging everything worked fast and good !)
Hope this helps some people out there - Watin is a great web automation tool !
Monday, August 29, 2011
Tuesday, August 9, 2011
netbeans 7 dark background theme (fonts and colors)
A good programming scheme/theme with a dark/black background for use with netbeans can be found here
I use it for java/jsp and netbeans 7 but it can be used for any language.
Here is a preview:
Recommended !
I use it for java/jsp and netbeans 7 but it can be used for any language.
Here is a preview:
Recommended !
Sunday, August 7, 2011
Refreshing changes in a webservice in the client in visual studio
When working on a solution which contains a web service project and a client project that calls the web service, typically you will perform changes in the webservice definitions (changing/adding methods and signatures to the web service) which you would like to be shown in the intellisense and when compiling the client.
You would assume all you need to do is compile the webservice and publish it after the change and then right-click on the webservice web reference in the client project and do 'update web reference' and that's it.
But there seems to be problems with this method - as changes are still not reflected.
What i found to work is to 'rebuild' on the web service + publish it.
Then open the wsdl in a web broswer - see the actual change.
Then right-click on the webservice web reference in the client project and do 'update web reference'.
Then, republish the web service again.
You would assume all you need to do is compile the webservice and publish it after the change and then right-click on the webservice web reference in the client project and do 'update web reference' and that's it.
But there seems to be problems with this method - as changes are still not reflected.
What i found to work is to 'rebuild' on the web service + publish it.
Then open the wsdl in a web broswer - see the actual change.
Then right-click on the webservice web reference in the client project and do 'update web reference'.
Then, republish the web service again.
Subscribe to:
Posts (Atom)