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

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -