In order to provide you with a secure cross browser testing environment on-cloud, we recommend you to integrate LambdaTest Authentication Credentials in your test scripts. This would allow our cloud servers to establish a secure connection between your local system & our cloud-based Selenium Grid. This document will help you understand how to set up your LambdaTest authentication credentials as environment variables for your respective operating system. This set up would also help authenticate your colleague’s test cases when executed against an individual account.
LambdaTest Authentication Credential consists 2 fields:
You can find these authentication credentials by either visiting the Automation Dashboard or your LambdaTest Profile.
Step 1: Visit the Automation tab from the left navigation menu.
Step 2: Click on the key icon from the right side of your screen and copy the Access Key and Username.
Step 1: Visit your LambdaTest Profile by clicking on the user icon on the top-right & going to Profile.
Step 2: You will find your Username & Access Key.
Step 1: Open your terminal mode, and provide the command vi ~/.bash_profile
& hit Enter.
Step 2: To perform text-insertion into your profile, you would need to press the i button from your keyboard.
Step 3: Feed LambdaTest Authentication credentials using the below:
1 2 |
$ export LT_USERNAME=<your lambdatest username> $ export LT_ACCESS_KEY=<your lambdatest access_key> |
Step 4: Hit Esc once you have entered the above lines into your Profile.
Step 5: Long-press the Shift button & hit Z twice (z z) to save your file and quit vi.
Step 6: Enter source ~/.bash_profile
into the terminal.
Step 1: Right-click on the Computer icon to access your Computer Properties. You could also follow the path(Control Panel\All Control Panel Items\System
) into your computer address bar.
Step 2: Go-to Advanced system settings & click on Environment Variables.
Step 3: You will notice a dialog would prompt open for the Environment Variables. Now, click on New under the System variables.
Step 4: Enter LT_USERNAME
as the Variable name & provide your LambdaTest Username
as the Variable value.
Step 5: Hit Ok & repeat the steps for adding LambdaTest Access Key
as another System Envrionment Variable.
Now that we have set up our LambdaTest Authentication Credentials as System Environment Variables, we need to incorporate them in our Selenium automation scripts for invoking your automation test suites on LambdaTest Selenium Grid. In this section, you will learn how to reference environment variables for different programming languages with respect to LambdaTest Selenium Grid.
1 2 |
lambdatestUserName = System.getenv("LT_USERNAME"); lambdatestAccessKey = System.getenv("LT_ACCESS_KEY"); |
1 2 |
lambdatest_username = os.environ["LT_USERNAME"] lambdatest_access_key = os.environ["LT_ACCESS_KEY"] |
1 2 |
let username = process.env.LT_USERNAME, accessKey = process.env.LT_ACCESS_KEY, |
1 2 3 |
exports.config = { lambdatestUser: process.env.LT_USERNAME, lambdatestKey: process.env.LT_ACCESS_KEY, |
1 2 |
username: ENV['LT_USERNAME'], accessKey: ENV['LT_ACCESS_KEY'] |
1 2 3 4 |
var lambdatestUserName = Environment.GetEnvironmentVariable("LT_USERNAME", EnvironmentVariableTarget.User); var lambdatestAccessKey = Environment.GetEnvironmentVariable("LT_ACCESS_KEY", EnvironmentVariableTarget.User); |
1 2 |
$user = getenv('LT_USERNAME') $accesskey = getenv('LT_ACCESS_KEY') |