TestProject Forum

Unable to create ChromeDriver via TestProject

Hi,

My tests were working fine till yesterday. However, since today I am hitting a failure to create webdriver at below step.

                    //ChromeDriver driver = new ChromeDriver("XXXXXXXXXXXXXXXXXXXXXXXXX",new ChromeOptions());
                    ChromeDriver driver = new DriverBuilder<ChromeDriver>(new ChromeOptions())
                            .withToken("XXXXXXXXXXXXXXXXXXXXXXXXXXXX")
                            .withReportType(ReportType.LOCAL)
                            .withReportPath("C:\\Users\\anithiya\\git\\test-automation-ctca-framework\\target\\testProject_reports")
                            .build(ChromeDriver.class);
> Error logs:
> 2021-05-23 13:38:15.715                         ERROR 14668 qtp619882055-74 i.t.a.w.r.e.DevelopmentEndpoints         Failed creating new session.
> org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
> Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
> System info: host: 'WW-7DQNQ13', ip: '192.168.1.19', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.1'
> Driver info: driver.version: unknown
> Command duration or timeout: 19 milliseconds
> 	at jdk.internal.reflect.GeneratedConstructorAccessor56.newInstance(Unknown Source)
> 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
> 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
> 	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: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.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.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
> 	at io.testproject.agent.managers.d.e.a(TestProjectAgent:1648)
> 	at io.testproject.agent.managers.b.a.a(TestProjectAgent:275)
> 	at io.testproject.agent.e.b.a.a.a(TestProjectAgent:232)
> 	at io.testproject.agent.e.b.a.b.a(TestProjectAgent:102)
> 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> 	at io.testproject.agent.c.d.run(TestProjectAgent:33)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> 	at java.base/java.lang.Thread.run(Thread.java:830)
> Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
> Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
> System info: host: 'WW-7DQNQ13', ip: '192.168.1.19', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.1'
> Driver info: driver.version: unknown
> Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
> System info: host: 'WW-7DQNQ13', ip: '192.168.1.19', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '13.0.1'
> Driver info: driver.version: unknown
> 	at org.openqa.selenium.grid.session.remote.ServicedSession$Factory.lambda$get$0(ServicedSession.java:135)
> 	at org.openqa.selenium.grid.session.remote.ServicedSession$Factory.apply(ServicedSession.java:152)
> 	at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12(ActiveSessionFactory.java:180)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
> 	at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
> 	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
> 	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> 	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
> 	at org.openqa.selenium.remote.server.ActiveSessionFactory.apply(ActiveSessionFactory.java:183)
> 	at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2(NewSessionPipeline.java:66)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
> 	at java.util.Collections$2.tryAdvance(Collections.java:4747)
> 	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
> 	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> 	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
> 	at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3(NewSessionPipeline.java:69)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.DistinctOps$1$2.accept(DistinctOps.java:174)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
> 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
> 	at java.util.stream.Streams$StreamBuilderImpl.tryAdvance(Streams.java:397)
> 	at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:720)
> 	at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
> 	at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> 	at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
> 	at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession(NewSessionPipeline.java:72)
> 	at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute(BeginSession.java:65)
> 	at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0(WebDriverServlet.java:235)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> 	at java.lang.Thread.run(Thread.java:830)
> 2021-05-23 13:38:15.717                         ERROR 14668 qtp619882055-74 i.t.a.w.r.m.AppExceptionMapper           io.testproject.java.exceptions.AppException: Unable to create new service: ChromeDriverService

I changed your dev token here in the post, it’s not a good practice to post them live :wink:
if you didn’t changed anything I recommend you to go to a integration section in TestProject and generate a new token, paste it in the code reset the agent and try again.
if it doesn’t helps, try to reboot your desktop
if all that doesn’t help and as a last resort delete your from TP and install + register once again.

let me know if it helps

Thank you so much. Appreciate your assistance

@Mark_K - Hi Mark, I tried the above and it unfortunately did not work. In terms of changes, I did upgrade the Testproject version from 1.1.0 to 1.2.0. What version of Selenium does it support?

What else can cause the mentioned error?

Below are my dependencies:

testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
testCompile 'org.junit.jupiter:junit-jupiter:5.6.0'
implementation group: 'org.testng', name: 'testng', version: '6.14.3'
testCompile group: 'com.codeborne', name: 'selenide', version:'5.20.1'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-java', version:'3.141.59'
testCompile group: 'org.seleniumhq.selenium', name: 'selenium-api', version:'3.141.59'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-api', version: '3.141.59'
implementation group: 'io.testproject', name: 'java-sdk', version: '1.2.0-RELEASE'

The main thing I noted is that when it tries to build the ChromeDriver.class, it hits the below error when viewing in debug mode:

org.openqa.selenium.WebDriverException: Failed to create an instance of io.testproject.sdk.drivers.web.ChromeDriver
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘WW-7DQNQ13’, ip: ‘192.168.1.19’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘12.0.2’
Driver info: driver.version: unknown

@david.goichman can you take a look into that?

@anithiya you mean 2.1.0 and 2.2.0? for now you can downgrade your agent until we will find the root cause

I mean 1.2.0 : https://mvnrepository.com/artifact/io.testproject/java-sdk

and which agent version you are using?

Agent version: 2.1.1.387

I tried downgrading to 1.1.0 version as well and suddenly i am not able to use that too.

Hi @anithiya,

Can you please send your Agent logs zip to support@testproject.io ?

It can be downloaded from the Agents section on the platform:

image

image

Meanwhile, I’ll attempt to reproduce the issue based on the information you’ve provided here.

Could you also please tell me what Chrome version are you using?

Chrome Version: 90.0.4430.212

One important note, here, My agent is not registered yet. I am unable to register it due to firewall issues within my corporate network. I am working on getting this resolved as Security assessment is underway. However, regardless, I have been able to execute the automation without seeing results in AppTestproject.io.

Since day before yesterday, I am hitting issues in trying to execute tests. I have emailed the logs to team.

Got it. if your agent is not registered try to run it without any developer key in the constructor.
You don’t need developer keys in non-registered agents, this might the reason for the failure

HI Mark, tried that. Didnt help. The failure occurs when trying to build ChromeDriver.class at:

                    ChromeDriver driver = new DriverBuilder<ChromeDriver>(new ChromeOptions())
                            .withReportType(ReportType.LOCAL)
                            .withReportPath("C:\\Users\\git\\test-automation-ctca-framework\\target\\testProject_reports")
                            .build(ChromeDriver.class);

Hi Ajay,

Following our meeting, I would like to summarize what we’ve discussed.

First of all, we’ve added documentation for a non-registered (unregistered) or an offline Agent: Unregistered/Offline Agent - TestProject Documentation

This documentation section, explains what is the TestProject Agent unregistered and offline mode, as well as the limitations, including the details on how to update the drivers manually if needed, such as in your case.

As well, when there is security software blocking the use of a driver, due to organizational security policies, because of its location on the file system, the solution to this, is starting the TestProject Agent with a custom working folder as explained here:

https://intercom.help/testprojectio/en/articles/5269133-managing-it-restrictions-using-testproject-cli-command-line-interface

So that the executable will launch and be able to automate the browsers.

Thank you Marat. Appreciate it.

Hello @marat @david.goichman @Mark_K @amit.lacher

I am noticed that in a new VDI I got where I followed the steps mentioned above. I changed the data path of the drivers for TestProject using commend:

testprojectagent -d C:\New_Software\TestProject

And then when I tried to start the Test Project Agent with the below command I get an error:

testproject-agent start --data-path=C:\New_Software\TestProject -f

Error:

C:\Program Files\TestProject Agent>testproject-agent start --data-path=C:\New_Software\TestProject -f
Failed to load native library:jansi-2.3.1-bb3dad6cc0343109-jansi.dll. osinfo: Windows/x86_64
java.lang.UnsatisfiedLinkError: C:\Users\usr\AppData\Local\Temp\jansi-2.3.1-bb3dad6cc0343109-jansi.dll: Access is denied
Exception in thread “main” java.lang.ExceptionInInitializerError
at org.fusesource.jansi.AnsiConsole.ansiStream(AnsiConsole.java:239)
at org.fusesource.jansi.AnsiConsole.initStreams(AnsiConsole.java:542)
at org.fusesource.jansi.AnsiConsole.systemInstall(AnsiConsole.java:496)
at io.testproject.agent.cli.Program.main(TestProjectAgent:71)
Caused by: java.lang.RuntimeException: Unable to load jansi native library
at org.fusesource.jansi.internal.JansiLoader.initialize(JansiLoader.java:62)
at org.fusesource.jansi.internal.CLibrary.(CLibrary.java:30)
… 4 more
Caused by: java.lang.Exception: No native library found for os.name=Windows, os.arch=x86_64, paths=[/org/fusesource/jansi/internal/native/Windows/x86_64;C:\Program Files\TestProject Agent;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\HID Global\ActivClient;C:\Program Files\HID Global\ActivClient;C:\Program Files\HID Global\ActivClient;C:\Program Files\Citrix\System32;C:\Program Files\Citrix\ICAService;C:\Program Files\Java\jre1.8.0_281\bin;C:\Users\anithiya\AppData\Local\Microsoft\WindowsApps;C:\Program Files\TestProject Agent;.]
at org.fusesource.jansi.internal.JansiLoader.loadJansiNativeLibrary(JansiLoader.java:333)
at org.fusesource.jansi.internal.JansiLoader.initialize(JansiLoader.java:60)
… 5 more
Failed to launch JVM

Can you please let me know what could cause this

The local admin privileges’ on that VDI do not allow the " C:\Users\usr\AppData\Local\Temp\jansi-2.3.1-bb3dad6cc0343109-jansi.dll" to be executed. Is there a way to work around this?

Hi @anithiya

I sent you a message in the application via Intercom,
please check it out.

Thanks for helping me troubleshooting this and testing the next beta version of the CLI.
We will include this fix in the next Agent version 2.4.0