'AWS Lambda Selenium WebDriver - Error Loading ibglib-2.0.so
I'm trying to run a headless version of Chrome in a Lamdba function. I need a way to request a url, load the page and run any javascript on that page. So far my funcion is:
public class Function
{
public string FunctionHandler(string input, ILambdaContext context)
{
IWebDriver driver = GetDriver(context);
driver.Navigate().GoToUrl("https://www.mybaggage.com/");
driver.Quit();
return input?.ToUpper();
}
public IWebDriver GetDriver(ILambdaContext context)
{
var tmpPath = Path.GetTempPath();
DriverManager driveManager = new DriverManager();
driveManager.SetUpDriver(
"http://chromedriver.storage.googleapis.com/85.0.4183.38/chromedriver_linux64.zip",
Path.Combine(tmpPath, "chromedriver"),
"chromedriver"
);
ChromeOptions options = new ChromeOptions();
options.AddArguments(new List<string>() {
"--no-sandbox",
"--headless",
"--disable-gpu",
$"--homedir={tmpPath}"
});
return new ChromeDriver(tmpPath, options);
}
}
This results in the following error:
/tmp/chromedriver: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory
I've added a package called glib, however I still recieve the error. The packages installed are:
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.0.0" />
<PackageReference Include="glib" Version="2.36.2.11" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="WebDriverManager" Version="2.9.3" />
Is there a way to resolve the error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
