└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # How to add extension for automation test in Python-selenium for [LambdaTest](https://www.lambdatest.com/?utm_source=github&utm_medium=repo&utm_campaign=Python-selenium-add-extension) 2 | 3 | If your webapp requires an extension for automation test in Python-selenium on Lambdatest, you can use the following steps to upload extension and run your test. You can refer to sample test repo [here](https://github.com/LambdaTest/python-selenium-sample). 4 | 5 | # Steps: 6 | 7 | ## Step 1: Get the zip file (Skip this if you already have the zip file with you) 8 | 9 | Note: You will need the Chrome Extensions's ID for this. I am referring it to as $ID$. You can get the $ID$ from the URL of the Chrome Extension page. 10 | 1. Install your desired chrome extension on chrome. 11 | 2. Go to Chrome's Extensions page (chrome://extensions/), Enable the developer mode (check the developer mode box) and take note of the ID for your desired extension. 12 | 3. Your extension will be located at: 13 | 14 | For Unix, ~/.config/google-chrome/Default/Extensions/$ID$ 15 | 16 | For Windows, C:\Users\\AppData\Local\Google\Chrome\User Data\Default\Extensions\$ID$ 17 | 18 | For OSX, ~/Library/Application Support/Google/Chrome/Default/Extensions/$ID$ 19 | 20 | ## Step 2: Upload the zip file to LamdbaTest using API 21 | 22 | 1. * [Use the LambdaTest extension upload API to upload the zip file to the backend.](https://www.lambdatest.com/support/api-doc/#/extensions/UploadExtensions) 23 | 24 | 2. Copy the link to your extension which will look something like - https://automation-prod-user-files.s3.amazonaws.com/extensions/orgId-XXXX/2.1.0_0.zip 25 | 26 | ## Step 3: Pass extension in capabilities 27 | 28 | In the test file, you need to update the test capabilities and add the extension capability. For example: 29 | 30 | ```python 31 | desired_caps = { 32 | 'LT:Options': { 33 | "build": "Python Demo", # Change your build name here 34 | "name": "Python Demo Test", # Change your test name here 35 | "platformName": "Windows 11", 36 | "selenium_version": "4.0.0", 37 | "lambda:loadExtension": "https://automation-prod-user-files.s3.amazonaws.com/extensions/orgId-XXXX/2.1.0_0.zip" 38 | }, 39 | "browserName": "Chrome", 40 | "browserVersion": "98.0", 41 | } 42 | 43 | ``` 44 | 45 | ## Step 4: Run your test 46 | 47 | ```bash 48 | python lambdatest.py 49 | ``` 50 | 51 | 52 | # Links: 53 | 54 | [LambdaTest Community](http://community.lambdatest.com/) 55 | 56 | --------------------------------------------------------------------------------