Entering the login credentials twice when creating multiple nodes with Selenium Grid -
i able create hub , 2 different nodes on 2 different machines run tests in parallel selenium grid. problem facing not being able register nodes hub , when run tests in firefox , chrome browsers, enters username , password twice on login page. here code snippets , testng xml file.
this driver initializer file:
package common; import java.net.malformedurlexception; import java.net.url; import java.util.concurrent.timeunit; import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.firefox.firefoxdriver; import org.openqa.selenium.ie.internetexplorerdriver; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import org.testng.annotations.aftersuite; import org.testng.annotations.beforesuite; import org.testng.annotations.beforetest; import org.testng.annotations.parameters; import com.relevantcodes.extentreports.extentreports; import com.relevantcodes.extentreports.extenttest; import com.relevantcodes.extentreports.logstatus; import org.openqa.selenium.firefox.firefoxprofile; import org.openqa.selenium.firefox.internal.profilesini; public class driverinitializer extends extentreportng { public static remotewebdriver driver; public static extentreports extent; public static profilesini profile; public static firefoxprofile fp; @parameters({"browser","appurl"}) @beforetest public webdriver openbrowser(string browser, string appurl) throws malformedurlexception { // launch specified browser try{ if(browser.equalsignorecase("firefox")){ desiredcapabilities capabilities = desiredcapabilities.firefox(); capabilities.setcapability("platform", "windows 7"); capabilities.setcapability("version", "40.0.0.3"); capabilities.setcapability("maxinstances", 1); driver = new remotewebdriver(new url("http://10.3.150.184:4455/wd/hub"), capabilities); driver.manage().timeouts().implicitlywait(10,timeunit.seconds); driver.manage().window().maximize(); driver.get(appurl); return driver; }else if(browser.equalsignorecase("chrome")){ /* system.setproperty("webdriver.chrome.driver",chrome_driver); driver = new chromedriver();*/ system.setproperty("webdriver.chrome.driver",chrome_driver); desiredcapabilities capabilities = desiredcapabilities.chrome(); capabilities.setcapability("platform", "windows 7"); capabilities.setcapability("version", "54"); capabilities.setcapability("maxinstances", 1); driver = new remotewebdriver(new url("http://10.3.150.38:5555/wd/hub"), capabilities); driver.manage().window().maximize(); driver.get(appurl); return driver; }else if(browser.equalsignorecase("ie")){ system.setproperty("webdriver.ie.driver",ie_driver); driver = new internetexplorerdriver(); driver.manage().window().maximize(); driver.get(appurl); return driver; } } catch(exception e){ e.getmessage(); } return driver; } public static webdriver getdriver(){ return driver; } } , testng xml file. <?xml version="1.0" encoding="utf-8"?> <!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="branchsmokesuite" parallel="tests" verbose="1"> <!-- <suite name="branchsmokesuite" parallel="false" verbose="1"> --> <listeners> <listener class-name="org.uncommons.reportng.htmlreporter"/> <listener class-name="org.uncommons.reportng.junitxmlreporter"/> <listener class-name="common.extentreportng" /> </listeners> <test name="chrometest"> <parameter name="browser" value="chrome"/> <parameter name="appurl" value="http://branch-1-11.vibeoffice.com/"/> <classes> <class name="common.driverinitializer"/> <class name="common.logincredentials"/> <class name="vibe.calendar.tests.calendar_tests"> <methods> <include name="createnewcalendarevent"></include> </methods> </class> </classes> </test> <test name="firefoxtest"> <parameter name="browser" value="firefox"/> <parameter name="appurl" value="http://branch-1-11.vibeoffice.com/"/> <classes> <class name="common.driverinitializer"/> <class name="common.logincredentials"/> <class name="vibe.calendar.tests.calendar_tests"> <methods> <include name="createnewcalendarevent"></include> </methods> </class> </classes> </test> </suite> in advance, neelima.
Comments
Post a Comment