selenium - Testing multiple browsers with different options using WebDriver, Nunit and C#? -
i trying run test on multiple browsers using webdriver, nunit , c#. it's working, getting annoying security warning in chrome. in effort fix it, need re-create driver using ".addarguments("--test-type"); ". want if iterations browser = chrome. here code. works, launches un-needed browser window first. have idea's around this?
namespace seleniumtests { [testfixture(typeof(firefoxdriver))] [testfixture(typeof(internetexplorerdriver))] [testfixture(typeof(chromedriver))] public class testwithmultiplebrowsers<twebdriver> twebdriver : iwebdriver, new() { private iwebdriver driver; [setup] public void createdriver() { this.driver = new twebdriver(); //creates window needs closed , re-constructed if(driver chromedriver) { driver.quit(); //this kills un-needed driver window created above var chromeoptions = new chromeoptions(); chromeoptions.addarguments("--test-type"); driver = new chromedriver(chromeoptions); } }
why not simpley create chromedriver in base class well? can use chromoptions
there pass necessary arguments. use
[testfixture(typeof(firefoxdriver))] [testfixture(typeof(internetexplorerdriver))] [testfixture(typeof(chromedriver))]
that save unncessary code duplication , confusion well.
i have full implementation of driver instances here
Comments
Post a Comment