public class BaseEngine {
protected static ThreadLocal<WebDriver> driver=new ThreadLocal<WebDriver>();
@BeforeMethod
public void setUp()
{
System.out.println("Test before method");
String strBinaryPath=System.getProperty("user.dir")+File.separator+"drivers"+File.separator+"chromedriver";
System.out.println("Chrome binary path "+strBinaryPath);
System.setProperty("webdriver.chrome.driver",strBinaryPath);
WebDriver cDriver=new ChromeDriver();
driver.set(cDriver);
}
public WebDriver getDriver()
{
return driver.get();
}
@AfterMethod
public void tearDown()
{
getDriver().quit();
System.out.println("Test after method");
}
}
Here is my simple test
public class MyTest extends BaseEngine{
@Test
public void googleTest1() throws InterruptedException
{
getDriver().get("http://www.google.co.in/");
System.out.println("Google test: "+getDriver().getTitle()+" "+Thread.currentThread().getId());
}
}
When i run the above as 'testng test' or mvn test / mvn clean install works fine.
I wanted to build the above as docker image and here is my Docerfile at the project source folder
Getting below error. Can someone assist how to overcome this issue?
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running MyTest
Test before method
Chrome binary path /drivers/chromedriver
/drivers/chromedriver: line 1: syntax error: unexpected ")"
Aug 27, 2020 9:07:03 AM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2)
Tests run: 3, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 21.632 sec <<< FAILURE! - in MyTest
setUp(MyTest) Time elapsed: 21.236 sec <<< FAILURE!
org.openqa.selenium.WebDriverException:
Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '0476f6e647ff', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.125-linuxkit', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:7922/status] to be available after 20002 ms
Caused by: java.util.concurrent.TimeoutException
Results :
Failed tests:
MyTest>BaseEngine.setUp:20 » WebDriver Timed out waiting for driver server to ...
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/c6f87e4c-3025-404d-b4e7-a93fd1bb14c8o%40googlegroups.com.