IllegalAccessError thrown by new ChromeDriver() on OSX (Java)

后端 未结 3 1440
时光说笑
时光说笑 2021-02-18 18:32

Getting this under Eclipse straight out of the gate.

Code:

    System.setProperty(\"webdriver.chrome.driver\" ,  \"/path/to/selenium/chromedriver\");
            


        
相关标签:
3条回答
  • 2021-02-18 19:03

    the main problem is you have a jar conflict.

    selenium has compile dependency on guava, you can find this at: https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver/3.141.0

    if you project has another version of guava, it may use wrong guava version.

    to exclude duplicate dependency in maven, you can add right guava version explicitly, in this case:

    <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>25.0-jre</version>
    </dependency>
    
    0 讨论(0)
  • 2021-02-18 19:08

    Setting this back to 22.0 helped for me.

    Version 22.0 didn't fix the problem for me, but 19.0 did.

    compile group: 'com.google.guava', name: 'guava', version: '19.0'
    
    0 讨论(0)
  • 2021-02-18 19:10

    Setting this back to 22.0 helped for me.

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>22.0</version>
        </dependency>
    
    0 讨论(0)
提交回复
热议问题