Please see the screenshots. I tried all possible ways but still getting the same error.
where are you initialing driver? where are you setting desired capabilities.
Hello,
I am initializing driver in my Basetest case and in hub. Please let me know where I am going wrong since the program runs fine if I do not use grid ie.., I keep boolean gridRun = false
Hub start command:
java -Dwebdriver.ie.driver=C:\Selenium\IEDriverServer.exe -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe -jar selenium-server-standalone-3.0.0-beta2.jar -role webdriver -browser browserName=firefox,version=48,maxInstances=3,platform=WINDOWS -hub http://10.0.0.94:4444/grid/register -port 5557
Please see the code below.
public class BaseTest {
public WebDriver driver;
public Properties prop;
//private locatorKey
public String locatorKey;
public ExtentReports rep = ExtentManager.getInstance();
public ExtentTest test;
boolean gridRun = true;
public void init(){
if(prop==null)
{
prop=new Properties();
try {
FileInputStream fs = new FileInputStream(System.getProperty("user.dir")+"//src//test//resources//projectconfig.properties");
prop.load(fs);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void openBrowser(String bType) throws IOException
{
test.log(LogStatus.INFO,"Opening Browser "+bType);
if(!gridRun)
{
if(bType.equals("Mozilla")){
driver=new FirefoxDriver();
}
else if(bType.equals("Chrome")){
System.setProperty("webdriver.chrome.driver",prop.getProperty("chromedriver_exe"));
driver=new ChromeDriver();
}
else if(bType.equals("IE")){
System.setProperty("webdriver.ie.driver",prop.getProperty("iedriver_exe"));
//DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
//caps.setCapability("ignoreZoomSetting", true);
driver = new InternetExplorerDriver();
//driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
//driver.manage().window().maximize();
}
}
else //grid
{
DesiredCapabilities caps=null;
if(bType.equals("Mozilla")){
caps = DesiredCapabilities.firefox();
caps.setBrowserName("firefox");
caps.setJavascriptEnabled(true);
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
else if(bType.equals("Chrome")){
caps = DesiredCapabilities.chrome();
caps.setBrowserName("Chrome");
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
else if(bType.equals("IE")){
caps = DesiredCapabilities.internetExplorer();
caps.setBrowserName("IE");
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
try {
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), caps);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
test.log(LogStatus.INFO,"Browser Opened Successfully "+bType);
}}
delete this line
[code:pbb2h2ao]caps.setBrowserName("firefox");
[/code:pbb2h2ao]
I commented that line, still getting the below error..
org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities [{browserName=chrome, version=, platform=WINDOWS}]
Command duration or timeout: 16 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'GG-SPECTRE', ip: '10.0.0.94', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Hello,
I had already made the suggested changes but still getting the error. Please see the below code.
if(!gridRun)
{
if(bType.equals("Mozilla")){
driver=new FirefoxDriver();
}
else if(bType.equals("Chrome")){
System.setProperty("webdriver.chrome.driver",prop.getProperty("chromedriver_exe"));
driver=new ChromeDriver();
}
else if(bType.equals("IE")){
System.setProperty("webdriver.ie.driver",prop.getProperty("iedriver_exe"));
//DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
//caps.setCapability("ignoreZoomSetting", true);
driver = new InternetExplorerDriver();
//driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
//driver.manage().window().maximize();
}
}
else //grid
{
DesiredCapabilities caps=null;
if(bType.equals("Mozilla")){
caps = DesiredCapabilities.firefox();
//caps.setBrowserName("firefox");
caps.setJavascriptEnabled(true);
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
else if(bType.equals("Chrome")){
caps = DesiredCapabilities.chrome();
//caps.setBrowserName("Chrome");
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
else if(bType.equals("IE")){
caps = DesiredCapabilities.internetExplorer();
//caps.setBrowserName("IE");
caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);
}
try {
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), caps);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
test.log(LogStatus.INFO,"Browser Opened Successfully "+bType);
}}
yes, its the same error. please see below.
Error forwarding the new session cannot find : Capabilities [{browserName=chrome, version=, platform=WINDOWS}]
Command duration or timeout: 14 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'GG-SPECTRE', ip: '10.0.0.94', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
I am available on below timmings. Please let me know a suitable time.
saturday and sunday - 6AM IST to 10:30 AM and 6:30 PM to 10 PM IST
Monday to Friday - 6AM IST to 10:30 AM