Simple Browser Testing Tool
I love little simple batch files. Yesterday I decided to create a simple one to perform a beating of a task for me.
When developing, I keep Firefox and IE7 open at all times. Every time I’m working on a template, drop copy into a page, fix a bug, I always quickly check them in both browsers. However, once I finish a larger task, say complete a couple of templates or a small section with copy, I need to test in all of my browsers. That list now includes:
So, once I completed a section and was ready to do a little more involved browser testing, I needed to open each browser and drop in the url.
Very repetitive. Very boring. Perfect for a batch file.
So I’ve created this file and named it Browser-Testing.bat
@echo off
echo "Enter URL"
set /p URL=
C:
cd C:\Program Files\Netscape\Netscape\
START /max /wait Netscp.exe %URL%
cd C:\Program Files\Netscape\Navigator 9\
START /max /wait navigator.exe %URL%
cd C:\Program Files\Opera\
START /max /wait Opera.exe %URL%
cd C:\Program Files\Maxthon2\
START /max /wait Maxthon.exe %URL%
cd C:\Program Files\Safari\
START /max /wait Safari.exe %URL%
Simple enough. I’ll go over a few of the items so you know what they’re doing. Very rarely does someone need exactly what someone else has created . . often it’s a variation. So you can use this as a starting point, and edit to your specific needs.
- ECHO ON can be useful when debugging a problematic batch script, but we’ll turn it off for this example
- Prompt me for the URL
- Set that variable to URL
- My CMD prompt starts at the H:, so I need to point it to the C:
- Sends me to the correct location for my first browser
- Start the program. There are a couple of parameters that can be used here:
- /m - Minimizes the window
- /max - Maximized the window
- /r - Restores to the last window size
- / wait - Waits until you have closed this browser until it opens the next browser.
I actually like the fact that it waits until I’m done with NN7.2 and I’ve closed it before it opens NN9. You might not. If you don’t, delete the /wait.
This all works properly on my machine short of the fact that the URL variable will not pull into the Safari 3 Beta 1 browser. Not sure of the issue here . . I’m a front-end developer, not a programmer!
Any feedback is welcome.
Enjoy.
December 7th, 2007 at 7:38 am
Nice! Thanks! I’m curious about that issue as well. If I have a minute today (with my job, doubtful) or over the weekend I’m going to check that out.