While launching the Chrome driver I am getting "Session not created from timeout" - selenium

My error is:org.openqa.selenium.SessionNotCreatedException: session
not created from timeout: Timed out receiving message from renderer:
600.000 (Session info: chrome=79.0.3945.130) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System
info: host: 'swati-*con-Mac', ip: 'fe80:0:0:0:10ea:7ed8:242:224c%en0',
os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6',
java.version: '12.0.2' Driver info: driver.version: ChromeDriver
remote
Code I a am using is:
public static void initialization(){
String browserName = prop.getProperty("browser");
if(browserName.equals("chrome")){
System.setProperty("webdriver.chrome.driver", "/Users/swati/Drivers/chromedriver");
driver = new ChromeDriver();
}
else if(browserName.equals("FF")){
System.setProperty("webdriver.gecko.driver", "/Users/swati/Drivers/geckodriver");
driver = new FirefoxDriver();
}
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(TestUtil.PAGE_LOAD_TIMEOUT,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(TestUtil.IMPLICIT_WAIT, TimeUnit.SECONDS);
// Create a wait. All test classes use this.
wait = new WebDriverWait(driver, 15);
// Instantiate the Page Class
page = new PageGenerator(driver);
//driver.get(prop.getProperty("url"));

option 1:Change path till chrome.exe
System.setProperty("webdriver.chrome.driver", "/Users/swati/Drivers/chromedriver/chrome.exe");
Option 2:
Use latest chrome driver version compatible with your chrome browser.
Option 3
Refer old posts this might help you
org.openqa.selenium.SessionNotCreatedException: session not created exception

try this?
public static void main(String[] args) throws InterruptedException, AWTException {
//Initialize ChromeDriver Instance.
System.setProperty("webdriver.chrome.driver", "C:\\RPCPMAutomation\\WebDrivers\\chromedriver.exe");
"C:\RPCPMAutomation\WebDrivers\chromedriver.exe" - change this to your Chrome driver path.

Related

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService [duplicate]

This question already has an answer here:
SessionNotCreatedException: Message: Unable to create new service: ChromeDriverService with ChromeDriver and SeleniumGrid through Python
(1 answer)
Closed 3 years ago.
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Tried with
System.setProperty("webdriver.chrome.driver",
"E://Selenim Installations//Chrome
Driver//chromedriver_win32//chromedriver.exe");
public void testGrid() throws MalformedURLException {
DesiredCapabilities dc = new DesiredCapabilities().chrome();
dc.setPlatform(Platform.WINDOWS);
URL url = new URL("http://localhost:4444/wd/hub");
// URL url = new URL("http://localhost:4444/wd/hub");
WebDriver driver = new RemoteWebDriver(url, dc);
driver.get("https://ui.freecrm.com/");
System.out.println(driver.getTitle());
Expected: Driver should launch
Actual: Getting below error
org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'RISHI', ip: '192.168.0.5', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_201'
Driver info: driver.version: unknown
Command duration or timeout: 145 milliseconds
Make sure chromedriver.exe is set to a path.
System.setProperty("webdriver.chrome.driver","/path to/chromedriver.exe");
cap = DesiredCapabilities.chrome();
cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
browser = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);

" org.openqa.selenium.SessionNotCreatedException" for selenium grid

I am trying to run script to another vm but it give me following error message.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'BDQCC3', ip: '10.132.48.16', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: unknown"
MY code is
public static void main(String[] args) throws MalformedURLException
{
// TODO Auto-generated method stub
WebDriver driver;
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.WIN10);
driver = new RemoteWebDriver(new URL("http://10.132.48.16:5566/wd/hub"), capabilities);
driver.get("http://google.com");
System.out.println(driver.getTitle());
}
Seems the command executed on grid node (10.132.48.16) to register to grid hub(10.132.48.16) is not correct. I doubt the command missed the option: -Dwebdriver.chrome.driver= to sepecify the path of chromedriver.
Register commmand example:
java -jar %~dp0\selenium-server-standalone-2.45.0.jar -role node -nodeConfig node.json -Dwebdriver.chrome.driver=%~dp0\chromedriver.exe
login to the grid node 10.132.48.16, stop the register process and check the register command is correct, also please put the command at here to help us to resovle the problem.

When I am trying run a simple selenium webdriver Application, then the following error occurs

public class FirstTest
{
public static void main(String[] args)
{
WebDriver driver =new FirefoxDriver();
driver.get("https://www.google.co.in/");
driver.close();
}
}
Note: Webdriver Java Language Bindings 3.3.1
**Error:**
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#3c6f6d, version=, platform=ANY, firefox_profile=org.openqa.selenium.firefox.FirefoxProfile#1eb8acf}], required capabilities = Capabilities [{}]
Build info: version: 'unknown', revision: '86a5d70', time: '2017-02-16 07:47:51 -0800'
System info: host: 'RAJANIKANT', ip: '192.168.0.102', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:293)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:272)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:267)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:263)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:122)
at FirstTest.main(FirstTest.java:15)
If you are using WebDriver 3.3 or higher then you have to download the gecko driver .
This is the link to download the latest geckodriver.exe : Click here to download geckodriver
and then set system properties.
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Gecko {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", **path to your geckodriver.exe**");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.google.co.in/");
driver.close();
}
}

"UnreachableBrowserException" and "UnixUtils may not be used on Windows exception" after driver.quit while using MarionetteDriver

Environment- Firefox 48.0.2 and Selenium 3.0.0-beta2 versions ,i am getting below error -
1472824777259 Marionette INFO Listening on port 61096 [Child 5848]
WARNING: pipe error: 109: file
c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc,
line 343
[Child 4048] ###!!! ABORT: Aborting on channel error.: file
c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp,
line 2046 Exception in thread "main"
org.openqa.selenium.remote.UnreachableBrowserException: Error
communicating with the remote browser. It may have died. Build info:
version: '3.0.0-beta2', revision: '2aa21c1', time: '2016-08-02
15:03:28 -0700' System info: host: 'VM7-JDB-068', ip: '10.60.88.67',
os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',
java.version: '1.8.0_51' Driver info: driver.version: RemoteWebDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false,
marionette=true, appBuildId=20160823121617, version=, platform=XP,
proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false,
browserVersion=48.0.2, platformVersion=6.1,
XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox,
takesScreenshot=true, takesElementScreenshot=true,
platformName=Windows_NT, device=desktop}] Session ID:
499ab4bb-406d-4252-8b5d-808b22831595 at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:706)
at
org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:531)
at firefox_java.sample.main(sample.java:19) Caused by:
java.lang.IllegalStateException: UnixUtils may not be used on Windows
at
org.openqa.selenium.os.ProcessUtils.getProcessId(ProcessUtils.java:188)
at
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.getPID(UnixProcess.java:222)
at
org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$300(UnixProcess.java:201)
at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:132)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155)
at
org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:196)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:94)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649)
... 3 more on driver.quit();
Here is my Java code:
String marionetteDriverLocation = "\\Lib\\geckodriver.exe";
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in");
driver.quit();
Could you please help .
Thanks
Below is the working copy that I just now tried. If it doesn't work, then there should be problem with selenium jar or gecodriver.exe you are using.
public class MarrionateTest {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/BrowserDrivers/geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
WebDriver driver = new MarionetteDriver(cap);
driver.get("http://www.seleniumhq.org");
driver.close();
}
}
You have used MarionetteDriver but initializing FirefoxDriver().
Please try with WebDriver driver = new MarionetteDriver(cap); it should work.

Getting an exception while opening the Chrome Browser from Selenium 2 script

Program:
Below given is the code snipped i'm tring to run. However it is failing to open the Chrome Browser. Browser just opens and closes in fraction of a secod with the below given exception in the console.
public static void main(String[] args) {
WebDriver driver = null;
//Map<String, Object> testDataMap = null;
try{
//testDataMap = LoadConfiguration.getTestDataMap();
System.setProperty("webdriver.chrome.driver","D:\\chromedriver_win32\\chromedriver.exe");
Thread.sleep(5000l);
driver = new ChromeDriver();
//driver = LoadConfiguration.getDriver();
System.out.println("Opening the Browser");
driver.get("http://localhsot:5080/myWebSite/8450191#");
Thread.sleep(2000l);
System.out.println("Open the Browser");
System.out.println("");
System.out.println("Title" +driver.getTitle());
}catch (Exception ie){
ie.printStackTrace();
}finally{
System.out.println("Quitting the Browser");
if(null != driver){
driver.close();
driver.quit();
}
}
}
Exception:
Starting ChromeDriver (v2.9.248315) on port 13737
org.openqa.selenium.WebDriverException: unknown error: version info not a dictionary
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.99 seconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: '01hw535163', ip: '10.72.15.53', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_17'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at com.seic.scripts.TestScript.main(TestScript.java:24)
Quitting the Browser
OS: Windows 7, 64 bit
Browser Version: 21.0.1171.0
chromedriver=2.9.248315
Looks like old chrome version is causing this issue. Current chrome version is > 32. Update chrome and give a try.
Source