A tale of VMWare vs VirtualPC
One issue that I have with selenium and running tests through IE is the little popup dialog saying “The web page you are viewing is trying to close the window. do you want to close this window?”
Our tests use openWindow and then close them frequently.
I wrote a little AutoIt script to sit in the background and poll for that dialog and close it when it appears.
But sometimes the AutoIt script makes it difficult for me to use the PC at the same time as the scripts run, so I decided to use VirtualPC to run the Selenium-RC server. And that would surely solve my problems? But oh no, then my problems really began…
The once commercial (and I bought it) VirtualPC now has free status - download it and use it for Free.
So I used it to:
- Create a new Windows machine.
- Install the browsers,
- Install Java,
- Installed selenium,
- Copy across my AutoIt script,
- Got the IP address of the VirtualPC using “ipconfig -all” .
I then amended my test setup on my host machine to use the IP address of the VirtualPC as an argument in the DefaultSelenium constructor.
java -jar selenium-server.jar
As ever I title the command window so I can find the server easily in the TaskBar.
Start up my test and voila… Hmm…. Selenium test won’t connect to the server on the Virtual PC.
Issue with Selenium? Issue with VirtualPC setup? I’ll check… ping the virtual PC… no response.
Oh, OK - I’ll switch off the Firewall and enable pings from the advanced settings.
Still no response.
Hmmm… I can connect to the internet from the virtualPC. I can ping my host PC from the virtual PC. I don’t know why this won’t work.
Time to check with Google - and I see other people have experienced the same problem but none of the proffered solutions worked for me - time to get radical.
VMWare worked out of the box. I suspect that this happened because VMWare installs a ‘virtual ethernet card’ in your machine but I had to use Shared Network Connection in VirtualPC. So obviously not everyone will experience this problem.
Virtual PC has a lot going for it:
- you can create your own machine images,
- Microsoft give away some Compatibility images for compatibility testing.
Sadly for this one thing, on this one environment, it failed to meet my needs.
So if you want to run Selenium-RC Server in a virtual machine you have multiple options, VMWare player and VirtualPC as the most obvious. I didn’t need to go as far as using VirtualBox, but if I ever need a free solution for Mac I will try that.
Engage Soul voice: “But whatever you choose to use kids. Never forget… Testing and Virtualization - It’s good.”
- Internet Explorer Application Compatibility VPC Images The current set expire in Jan 2009 but Microsoft have a habit of updating them and keeping them going - a great way to install multiple browsers for testing with by the way.