So, I'm building a test project on java using Selenium, with gradle. Right now I need to scan a QR Code from a previously taken screenshot. I looked around how to do it, and the ZXing scanner code seems like the best suggestion. (Please let me know if it isn't.) My problem is, from the moment I add the 'com.google.zxing:zxingorg:3.3.1' dependency to my build.gradle file, even if I don't write any additional code with it (I've tried with and without), the web driver stops working, and I get this message:
java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter.<init>(Ljava/util/concurrent/ExecutorService;)V from class org.openqa.selenium.net.UrlChecker
at org.openqa.selenium.net.UrlChecker.<init>(UrlChecker.java:67)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
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.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:141)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:174)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:163)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:152)
at Specification.ClientFactory.initContext(ClientFactory.groovy:81)
at Specification.ClientFactory.<init>(ClientFactory.groovy:61)
at Specification.BaseTest.setupSpec(BaseTest.groovy:14)
Test ignored.
The code in which this error appears is the code I use to start the Selenium WebDriver:
ClientFactory(){
initUrl() //allows to change the URL of the application under test when needed
initContext(urlWebsite,initWebBrowser()) //switchcase to read the browser from a config file
initClient() //initialization of the different classes with the elements I'm accessing
}
The line 61 referred in the error refers to the initialisation of the Chrome WebDriver:
webDriver = new ChromeDriver(options)
(I tried disabling the options, and the error I get is exactly the same, so I don't think the problem comes from there.)
I looked quite a while for it already, and I didn't find anything regarding this error. Is there any conflict between the Selenium and ZXing dependencies that I don't know about? If so, is there a way to surpass it? How?
UPDATE: for whoever happens to face a similar problem, this issue won't happen if you regress to earlier versions of selenium-java and ZXing. I managed to overcome the problem with 'org.seleniumhq.selenium:selenium-java:3.0.1' and 'com.google.zxing:zxingorg:3.2.1' in my build.gradle file, which aren't the latest, but it works this way