java - Selenium Grid: how to maximize browser window using RemoteWebDriver and ChromeDriver -


i know how can maximize browser window using selenium grid , remotewebdriver popular browsers.

this question has not been solved yet in community, there question this: how maximize browser window in selenium webdriver (selenium 2) using c#? in question not clear how maximize browser window in remotewebdriver.

on firefox , ie guess in same way driver.manage().window().maximize();

in chrome have do:

chromeoptions options = new chromeoptions(); options.addargument("--start-maximized"); driver = new chromedriver(options);

the question how can apply remotewebdriver?

if understand question correctly want know how pass driver options remote driver.in case ever creating driver object need create desire capabilities , use 1 of constructor of remote driver capability parameter. example

desiredcapabilities capabilities = desiredcapabilities.chrome();  chromeoptions options = new chromeoptions();  options.addarguments("--start-maximized");   capabilities.setcapability(chromeoptions.capability, options);  driver = new remotewebdriver(url, capabilities); //driver = new chromedriver(capabilities); 

you can use qaf abstraction driver configuration , management outside code. can set driver capabilities using properties. alternate can use driver listener such purpose. example:

using properties:

following 2 properties needful chrome driver:

drive.name=chromedriver chrome.additional.capabilities={"chromeoptions":{"args":["--start-maximized"]}} 

for remote driver:

remote.server=<remote server or grid url> drive.name=chromeremotedriver chrome.additional.capabilities={"chromeoptions":{"args":["--start-maximized"]}} 

using listener:

void beforeinitialize(capabilities capabilities){     if(capabilities.getbrowsername().equalignorcase("chrome"){         chromeoptions options = new chromeoptions();          options.addarguments("--start-maximized");          ((desiredcapabilities)capabilities).setcapability(chromeoptions.capability, options);     } }  void oninitialize(qafextendedwebdriver driver){    //for browser other chrome...    driver.manage().window().maximize(); } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -