I moved my folder from my PC to my Macbook PRO, with all dependencies and everything else and when I try to run my tests I get this error below. I want to point out that I reimported dependencies, I even started to create a new project and I still have the same error, I watched a lot of tutorials to get to the bottom of this but I can't. I selected the path where the chromedriver is located I even added it to the bin folder in MAC. I'm using inteliJ with JDK 11.
At line 11 : WebDriver driver=new ChromeDriver();
I'm getting this console error below.
This is the code :
package com.qa.testing;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class HelloWorld {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/Users/Popita/Downloads/chromedriver");
WebDriver driver=new ChromeDriver();
}
}
Errors:
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'abc', ip: 'ab12', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.6.2', java.version: '11.0.14'
Driver info: driver.version: ChromeDriver
remote stacktrace: 0 chromedriver 0x000000010760fee9 chromedriver 5013225
1 chromedriver 0x000000010759b1d3 chromedriver 4534739
2 chromedriver 0x0000000107171a68 chromedriver 170600
3 chromedriver 0x000000010719149c chromedriver 300188
4 chromedriver 0x000000010718f756 chromedriver 292694
5 chromedriver 0x00000001071c9550 chromedriver 529744
6 chromedriver 0x00000001071c36d3 chromedriver 505555
7 chromedriver 0x000000010719976e chromedriver 333678
8 chromedriver 0x000000010719a745 chromedriver 337733
9 chromedriver 0x00000001075cbefe chromedriver 4734718
10 chromedriver 0x00000001075e5a19 chromedriver 4839961
11 chromedriver 0x00000001075eb1c8 chromedriver 4862408
12 chromedriver 0x00000001075e63aa chromedriver 4842410
13 chromedriver 0x00000001075c0a01 chromedriver 4688385
14 chromedriver 0x0000000107601538 chromedriver 4953400
15 chromedriver 0x00000001076016c1 chromedriver 4953793
16 chromedriver 0x0000000107617225 chromedriver 5042725
17 libsystem_pthread.dylib 0x00007fff2057c8fc _pthread_start 224
18 libsystem_pthread.dylib 0x00007fff20578443 thread_start 15 ```
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
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 com.qa.testing.HelloWorld.main(HelloWorld.java:11)
Process finished with exit code 1
Image of error:
[error1][1]
[1]: https://i.stack.imgur.com/j0BMf.png
CodePudding user response:
- based on the error, make sure you have Chrome installed
- make sure the file
/Users/Popita/Downloads/chromedriver
fits to Chrome version - clean and rebuild your project
CodePudding user response:
Chromedriver versions must be maintained in sync with the current version of chrome installed.