changed code to test presence of application (Firefox) instead of a widow