Skip to main content

Lambda Hooks For Selenium Automation


LambdaTest Selenium Grid offers a set of hooks also known as Lambda Hooks that you can leverage to modify your automation test cases and perform multiple operations in your automation scripts.

Below is the representation of the available Lambda Hooks along with the function it performs.

Lambda HooksDescriptions
lambda-statusCheck whether the test is passed or failed.
For Passed Test:
browser.executeScript("lambda-status=passed");
For Failed Test:
driver.executeScript('lambda-status=failed');
lambda-file-existsCheck whether the downloaded file exists in the test machine.
((JavascriptExecutor) driver).executeScript("lambda-file-exists=file-name.file_format");
lambda-file-statsRetrieve file metadata such as md5 code, modified time, name and size.
((JavascriptExecutor) driver).executeScript("lambda-file-stats=file-name.file_format");
lambda-file-contentDownload file content using base64 encoding.
((JavascriptExecutor) driver).executeScript("lambda-file-content=file-name.file_format");
lambda-file-listList down the file in download directory.
print driver.execute_script("lambda-file-list={match string with filename}");
ie:print driver.execute_script("lambda-file-list=sample");Response: List of files in downloads dir starting with sample
lambda-nameFor changing the Test Name.
((JavascriptExecutor) driver).executeScript("lambda-name=TestName");

Got Questions? Give a Shout to us. We're here for you 24/7.
Happy testing! :)

Last updated on