Forum Discussion
Yes. I did that. Alas that is not it.
Can I go back to square one for a moment?
Why do you want to move the execution of the browser from your code to an extension? The automation code for running browsers, even in a loop, is relatively simple. Help me understand what you're trying to achieve... there may be a better way.
- vthomeschoolmom5 years agoSuper Contributor
To answer yuor question, basically the encapsulation of a number of operations that are done consistently at the start of every test in a manner that is super simple for the test creators.
As to the solution, using the command directly rather than in batch was the thing. A little snip:
var runCommand = ""; //iexplore firefox chrome edge switch (ProjectSuite.Variables.BrowserUnderTest) { case "edge": runCommand = "cmd.exe /C start microsoft-edge:http://www.microsoft.com"; break; case "chrome": runCommand = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" break; default: runCommand = "cmd.exe /C start microsoft-edge:http://www.microsoft.com"; } WshShell.Run(runCommand);
- tristaanogre5 years agoEsteemed Contributor
Something to suggest.
Rather than use a project variable to dictate the conditions of the switch, make that a parameter passed in to the function. Then, if you still want to use the variable, you can... or, you can just pass in the string.
What I would also do is bullet proof the string. Wrap the condition of the "switch" with something like aqString.UpperCase and then have all the cases in all upper. I'd also, suggest that you account for different possible inputs. "Google Chrome" in addition to chrome... Microsoft Edge instead of just Edge... and, you know... the default works well... but I like to control my tests a little more closely... I'd set the default to log an error and throw an exception if the user enters anything other than the desired values... if not that, at LEAST log a warning like "Unknown browser indicated; Using Microsoft Edge as default" to communicate to your user that they did something wrong.
Just my $0.02... but these are things from experience. - vthomeschoolmom5 years agoSuper Contributor
All of the above. Haven't gotten there yet. Thanks
Related Content
- 8 years agoSundaytwins
Recent Discussions
- 3 days agovladd1