Add sleep after accepting and dismissing alert.

In some situation IE closes alerts window too slow
and this leads to next action on window fails with E_NOINTERFACE code, e.g.
executing script failed with '-2147467262 [No such interface supported]'.

Fixes issue 4108.
Improve code and checks in e2e test.

1. move some help code into function
2. add checks before start test for CrashWhenStartingBrowserTest