“ java.lang.IllegalStateException: The driver is not executable” error is coming when TestNG test cases run on Jenkins install on ubuntu 14.1

亡梦爱人 提交于 2019-12-11 03:52:48

问题


"java.lang.IllegalStateException: The driver is not executable" error is coming when TestNG test cases run on Jenkins install on ubuntu 14.1. As if Chromedriver is not starting on jenkin installed on ubuntu, Same configuration tried on jenkin install on Window os, works fine.Please provide me any solution if any.

Console Ouput :

run:
   [testng] org.testng.TestNGException: 
   [testng] Cannot instantiate class TestCase.NewsArticles_Section_TC
   [testng]     at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
   [testng]     at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
   [testng]     at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
   [testng]     at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
   [testng]     at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
   [testng]     at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
   [testng]     at org.testng.TestRunner.initMethods(TestRunner.java:409)
   [testng]     at org.testng.TestRunner.init(TestRunner.java:235)
   [testng]     at org.testng.TestRunner.init(TestRunner.java:205)
   [testng]     at org.testng.TestRunner.<init>(TestRunner.java:153)
   [testng]     at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
   [testng]     at org.testng.SuiteRunner.init(SuiteRunner.java:157)
   [testng]     at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
   [testng]     at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
   [testng]     at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
   [testng]     at org.testng.TestNG.createSuiteRunners(TestNG.java:1289)
   [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
   [testng]     at org.testng.TestNG.run(TestNG.java:1057)
   [testng]     at org.testng.TestNG.privateMain(TestNG.java:1364)
   [testng]     at org.testng.TestNG.main(TestNG.java:1333)
   [testng] Caused by: java.lang.reflect.InvocationTargetException
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   [testng]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   [testng]     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   [testng]     at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
   [testng]     ... 19 more
   [testng] Caused by: java.lang.ExceptionInInitializerError
   [testng]     at pagefactory.NewsArticle_Section.NewsArticle_Section_Add.<init>(NewsArticle_Section_Add.java:18)
   [testng]     at TestCase.NewsArticles_Section_TC.<init>(NewsArticles_Section_TC.java:14)
   [testng]     ... 24 more
   [testng] Caused by: java.lang.IllegalStateException: The driver is not executable: /var/lib/jenkins/jobs/Mentis kitchen test/workspace/lib/chromedriver.exe
   [testng]     at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
   [testng]     at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:126)
   [testng]     at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:117)
   [testng]     at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)
   [testng]     at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118)
   [testng]     at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291)
   [testng]     at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82)
   [testng]     at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
   [testng]     at reusablescript.driver.<clinit>(driver.java:12)
   [testng]     ... 26 more
   [testng] The tests failed.

makexsltreports:

回答1:


Looks like you are trying to run chromedriver.exe on Linux. You have to download binary file for Linux. .exe from stack trace doesn't look like correct one.

Then you have to add executable flag to it chmod +x chromedriver




回答2:


Given below permission to chromedriver and it works.

chmod 777 chromedriver

As previous answer there is no relevance to the .exe part in stack trace



来源:https://stackoverflow.com/questions/31000190/java-lang-illegalstateexception-the-driver-is-not-executable-error-is-coming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!