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

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

Related

Appium, error for create new session signature

cannot create new session for android 11.0 oppo because of the signature problem, i already try to enable "Disable permission Monitoring". its running on another device but not for this os
public class testjalan {
public static AndroidDriver<WebElement> driver;
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
//capabilities.setCapability("w3c", false);
capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));
//capabilities.setCapability("chromedriverExecutable",
driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://google.com");
driver.findElement(By.name("q")).sendKeys("Hello Appium !!!");
Thread.sleep(5000);
driver.quit();
error message that i getting
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'C:\Users\Lenovo IP320\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.24.0.apk'. Original error: The JAVA_HOME location 'C:\Program Files\Java\jre1.8.0_311' must exist
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'LAPTOP-3S5PCPN8', ip: '192.168.174.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'C:\Users\Lenovo IP320\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.24.0.apk'. Original error: The JAVA_HOME location 'C:\Program Files\Java\jre1.8.0_311' must exist
at getResponseForW3CError (C:\Users\Lenovo IP320\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
at asyncHandler (C:\Users\Lenovo IP320\AppData\Local\Programs\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'LAPTOP-3S5PCPN8', ip: '192.168.174.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:216)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:225)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:99)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:97)
at test.testjalan.main(testjalan.java:40)
what i try to fixing for running in os 11.0 for oppo phone
Please go through your error ,there its clearly telling what's causes your issue
Can you please set your java_path as displayed
Original error: The JAVA_HOME location 'C:\Program
Files\Java\jre1.8.0_311' must exist

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

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.

How to run selenium standalone server with Edge webdriver?

I'm trying to run Selenium tests against Edge, in the same way I successfully run with Chrome or Internet Explorer 11 but it fails.
What I do is starting the standalone selenium and it works fine:
java -Dwebdriver.edge.driver=C:\tmp\msedgedriver.exe -jar C:\tmp\selenium-server-standalone-3.141.59.jar -port 4445
But when I run the Selenium tests, it fails with the error below:
I've tried to add "-DbrowserName=edge" but it does not make any difference.
Is there something I've missed?
Build info: version: '3.8.1', revision: '6e95a6684b', time:
'2017-12-01T19:05:32.194Z' System info: host: 'MSEDGEWIN10', ip:
'10.0.2.15', os.name: 'Windows 10', os.arch: 'amd64', os.version:
'10.0', java.version: '1.8.0_201' Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:89)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:171)
at org.openqa.selenium.remote.server.DefaultSession.(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:76)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:72)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:63)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:37)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:191)
at org.openqa.selenium.remote.server.DriverServlet.lambda$handleRequest$0(DriverServlet.java:261)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748) 08:13:43.301 WARN - Exception: The best matching driver provider class
org.openqa.selenium.edge.EdgeDriver can't create a new driver instance
for Capabilities {browserName: edge}
Here's the java code I wrote to use Feature on Demand EdgeDriver. This has not been tested, so if you use it, let me know if it works:
String windir = System.getenv("windir");
boolean is64bit = false;
is64bit = (System.getenv("ProgramFiles(x86)") != null);
String edgeDriverPath = windir + "\\SysWOW64\\MicrosoftWebDriver.exe";
if (!is64bit)
{
edgeDriverPath = windir + "\\System32\\MicrosoftWebDriver.exe";
}
System.setProperty("webdriver.edge.driver", edgeDriverPath);
EdgeOptions edgeOptions = new EdgeOptions();
//edgeOptions.setPageLoadStrategy(stringPageLoadConstant);
try {
driver = new EdgeDriver(edgeOptions);
}
catch (Exception ex)
{
System.out.println ("Problem launching EdgeDriver: " + ex.toString());
}

Unable to open Google chrome using selenium webdriver [duplicate]

This question already has answers here:
WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome
(8 answers)
Closed 3 years ago.
I am trying open a google chrome using selenium webdriver but I'm getting the below error :
Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 18885
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 6.1.7600 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 110 milliseconds
Build info: version: '3.141.5', revision: 'd54ebd709a', time: '2018-11-06T11:58:41'
System info: host: 'ADMIN-PC', ip: '192.168.244.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_191'
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at demo.main(demo.java:9)
I have tried everything but no use.
Below is my program :
public class demo {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\Desktop\\Internal job application\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
}
}
Need assistance on what action needs to taken
You are getting that error because your chrome browser is not installed in the default installation directory or selenium not able to find executable chrome browser file.
To solve this problem, you need to tell the program where your chrome browser executable is present and for that you can use ChromeOptions class like below :
public class demo {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\Desktop\\Internal job application\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/chrome/binary"); // Provide absolute executable chrome browser path with name and extension here
WebDriver driver = new ChromeDriver(options);
driver.get("http://google.com");
}
}
I hope it helps...
Install Chrome browser in destination by default.
In this line:
System.setProperty("webdriver.chrome.driver", "destination to file"
destination to file is not destination to installed Chrome browser, but destination to downloaded here chrome driver.

"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.