I've been stuck with this error "Caused by: java.lang.IllegalStateException: The driver is not executable: /var/task/chromedriver"
When I deploy my jar project into aws lambda function. The project works fine on my local machine, but it seems like aws can't execute chromedriver for some reason.
My chromedriver file is placed in the resources folder.
Following is my test config file:
@Configuration
public class TestConfig {
private static final Logger l = LoggerFactory.getLogger(TestConfig.class);
private String chromeDriver = org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS ? "chromedriver.exe" : "chromedriver" ;
public WebDriver getDriver(){
URL resource = getClass().getClassLoader().getResource(chromeDriver);
String chromePath = null;
try {
chromePath = Paths.get(resource.toURI()).toString();
} catch (URISyntaxException e) {
l.info("cannot find chromedriver in resources");
}
System.setProperty("webdriver.chrome.driver", chromePath);
return new ChromeDriver();
}
}
I have both chromedriver and chromedriver.exe, and I've tried to chmod 777 the file, but have no success.
chmodwould have any effect if you are doing it before creating the zip file -- there's not (afaik) a structure in a zip file to store permissions. Extract the zip file somewhere locally to check that. Maybe you could first mark the file executable using Java?