View on GitHub


Use Selenium Webdriver and Chrome inside AWS Lambda

Lambda-Selenium: Java Tutorial Build Status

Running The Example

Install the serverless framework

npm install serverless -g

Use shell commands to clone the repository and change the working directory to the Java example

git clone
cd lambda-selenium/lambda-selenium-java/

Packaging A New Function

To package the jar and deploy it, run the following command inside the lambda-selenium-java directory

gradle clean unzipLibs shadowJar deploy

This will package all of the required dependencies and code within the jar file. The libraries that we included in the resources folder will also be included in this jar. Once the jar has been built, you can find it in the build/libs folder. This jar will then be deployed as a new lambda function using the serverless framework.

Note: If you change the name to a different lambda function in the serverless.yml, you must change the name of the function that is invoked in the code in the class com.blackboard.testing.lambda.LambdaSeleniumService

Now the function is ready to be invoked.

Next, run the test suite ‘ExampleTestSuite’ inside the same shell :

gradle clean test

When the tests are ran, they will be executed in parallel by invoking the Lambda function that was created. Once the tests are complete, open folder ‘./build/screenshots’ to view screenshots taken inside the running tests. If a test fails, the exception will be thrown for the test case and logged to the console.