Refactoring running of selenium tests environment, so that it would be easier to do that. (cherry picked from commit 09c5e46) (cherry picked from commit 78ae811)