I am looking to use Selenium Chromedriver in an AWS Lambda function using C# but I am not having much luck... My initial error that i was getting was that "chromedriver.exe does not exist in /tmp/". Using the Webdrivermanager got me past this error but now i am having issues with permissions "Access to the path '/tmp/' is denied."
I have google my fingers off and have tried multiple ways of getting this to work. I bet it is something small that i am missing.
Any help would be greatly appreciated.
using System.Collections.Generic;
using Amazon.Lambda.Core;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using WebDriverManager;
public class Function
{
public void FunctionHandler(string input, ILambdaContext context)
{
var driver = GetDriver();
driver.Navigate().GoToUrl(input);
driver.Quit();
}
public IWebDriver GetDriver()
{
new DriverManager().SetUpDriver(
"http://chromedriver.storage.googleapis.com/75.0.3770.8/chromedriver_win32.zip",
"/tmp/",
"chromedriver.exe"
);
ChromeOptions options = new ChromeOptions();
options.AddArguments(new List<string>() {
"--no-sandbox",
"--headless",
"--disable-gpu",
"--homedir=/tmp"
});
return new ChromeDriver("/tmp/", options);
}
}