Testing web pages in multiple browers with appleScript v.2

This is a follow up to a post from a few years ago: Using applescript to open a url in several browsers.
I’ve made some updates to the script since then and a few them were today so I thought I’d share.

The old script opened a URL in several browsers (failing to load the web page in parallels VM browsers). The updated script now plays nice with Parallels and captures any URL in your clipboard if applicable.
The key to playing nice with Parallels is to manually drag the application icon into the script so that the address of the browser in the remote VM is accessible to the script.
Here’s the updated script:

Code:

--openUrls.applescript
--A finder AppleScript
--
--Opens a url in multiple browsers
--
property listOfBrowsers : {"Firefox", "Safari", "/Applications/Google Chrome.app", "Opera", "/Users/vid/Applications (Parallels)/{78125d20-67a1-4266-accd-3073f020ce84} Applications.localized/Firefox [1].app", "/Users/vid/Applications (Parallels)/{78125d20-67a1-4266-accd-3073f020ce84} Applications.localized/Internet Explorer.app", "/Users/vid/Applications (Parallels)/{a9c62df1-c044-4a47-bf17-3ee229b2ba39} Applications.localized/Internet Explorer.app"}
try
	set goToUrl to (get the clipboard)
	try
		set goToUrl to goToUrl as string
		set firstFourUrl to (characters 1 thru 4 of goToUrl) as string
	on error
		set goToUrl to ""
	end try

	if firstFourUrl is not "http" then
		set goToUrl to ""
	end if

	try
		if goToUrl is "" then
			tell me to activate
			set goToUrl to the text returned of (display dialog "The clipboard was empty or not a well formed URL. Please copy your URL and try again." default answer "http://hr.uoregon.edu") -- giving up after 4

			if goToUrl is "" then
				display dialog "The clipboard could not be converted into text. Please copy your URL and try again."
				return false
			end if
		end if
	end try
end try

if goToUrl is not "" then
	try
		repeat with oneBrowser in listOfBrowsers
			tell application oneBrowser
				activate
				open location goToUrl
			end tell
			delay 1
		end repeat
	on error errMsg number errNum
		error errMsg number errNum
	end try
end if

If you wanted to use this script you’d do well to delete the custom paths to my VMs (like this one: /Users/vid/Applications (Parallels)/{78125d20-67a1-4266-accd-3073f020ce84} Applications.localized/Firefox [1].app) and replace them with your own.
It works great. One click and I can open the URL in 7 different browsers; 4 on my Mac and 3 in virtual PC’s. On that topic: I keep an old XP VM around for IE6 testing and keep Firefox 3 installed in Win 7 VM.

Road Map

In light of the changing browser landscape and responsive design, I think the next steps would be to add support for mobile device emulators. Or you could add an option to send an IM with the URL to yourself.

Usage:

I keep the script in my Dock for easy access: Screen Shot of the openUrls script in my OSX Dock

If I haven’t copied the URL to my clipboard (or there isn’t a well formed URL in the clipboard then I’m prompted for the address: Screen Shot of the Prompt

How’s it look?

Here’s a look at all 7 browsers open:

Screen Shot of all 7 browsers open across 1 mac and 2 VMs

Browsers from top to bottom, left - right: FF3 PC (Win7), IE9 (in IE7 Mode) (Win7), IE6 (WinXP), Opera 12 (Mac), Safari 6 (Mac), Chrome 22 (Mac), FF 16 (Mac)

Record keeping

To keep track of the X-Browser testing I keep a template handy for batch creating task lists in activeCollab.
Cross browser testing

  • OK in FireFox (modern) Mac
  • OK in Chrome (modern) Mac
  • OK in Safari (modern) Mac
  • OK in Opera (modern) Mac
  • OK in FireFox (modern) PC
  • OK in FireFox 3.x PC
  • OK in IE6 PC
  • OK in IE9 PC
  • OK in IE8 (virtual IE8 in IE9) PC
  • OK in IE7 (virtual IE7 in IE9) PC

As an aside I quite like the import feature of the Planning module add-on for this purpose.
With it, I can import this list of tasks into a milestone.
Screen Shot of planning module

I find that handy so I can track my progress.
Way back in the day I use to use this table:

Browser Check
Browser Page Status

Date

FireFox      
Safari      
Opera 6      
Opera 7      
Opera 9      
Camino      
iCab      
IE5.2 Mac      
IE 6 PC      
IE 7      
Netscape 6      
Netscpape 7      

Fhew! There’s some old browsers on there!

Comments
  • Max says:

    Nice work, that is a slick way to launch those browsers. I wonder if you can hook into firefox to autoload tabs in each of the responsive viewports?

Leave a Comment