- Notifications
You must be signed in to change notification settings - Fork5
A sample repo to help you upload a file on LambdaTest for an automation test in Python-selenium. Run your python automation test scripts on Lambdatest.
Elmasekar/Python-selenium-upload-file
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
How to upload file onLambdaTest for automation test in Python-selenium
If you want to upload a file to the LambdaTest and use it in your Python-selenium automation test, you can follow the below steps. You can refer to sample test repohere.
Use the LambdaTest file upload API to upload the file to the backend -https://api.lambdatest.com/automation/api/v1/user-files
In the test file, you need to update the test capabilities and add the filename for thelambda:userFiles
capability. For example, if two files with filenamesphoto1.png
andphoto2.png
, it has to be passed like so in the capability:
desired_caps= {'LT:Options': {"build":"Python Demo",# Change your build name here"name":"Python Demo Test",# Change your test name here"platformName":"Windows 11","selenium_version":"4.0.0","lambda:userFiles": ["photo1.png","photo2.png"] },"browserName":"Chrome","browserVersion":"98.0", }
The files can be used in your test like so:
- For Windows:
elm=driver.find_element_by_xpath("//input[@type='file']")elm.send_keys("C:\\Users\\ltuser\\Downloads\\photo1.png")
- For MacOS:
elm=driver.find_element_by_xpath("//input[@type='file']")elm.send_keys("/Users/ltuser/Downloads/photo1.png")
python lambdatest_test.py```# Links:[LambdaTest Community](http://community.lambdatest.com/)
About
A sample repo to help you upload a file on LambdaTest for an automation test in Python-selenium. Run your python automation test scripts on Lambdatest.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.