java - How to switch instances in WebDriver -


hi have following setup current framework,

classa {     //which receives selenium webdriver call 'driver' object reference manipulate locators in ui      public webdriver get()     {         return mainclass.driver;     } }  mainclass {     public static webdriver driver;     method a()     {         //which uses firefox instance , passed classa operate     driver = new firefoxdriver();     }      methodb()     {         //which creates new instance of chrome         driver = new chromedriver();     } } 

what wanted once call methodb() instance of chrome created once done want resume firefox instance available or invoked before chrome run, approach since referring same webdriver object old firefox reference getting deleted.

any suggestions ?

ps: please forgive bad code conventions followed

simplest solution create seperate objects ff , chrome. modify method take parameter(browsertype) , return correspoding object.

why switching browsers?


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -