88access_key = os .getenv ("LT_ACCESS_KEY" ) # Replace the access key
99
1010
11- class FirstSampleTest (unittest .TestCase ):
12- # Generate capabilites from here: https://www.lambdatest.com/capabilities-generator/
13- # setUp runs before each test case and
14- def setUp (self ):
15- desired_caps = {
16- 'LT:Options' : {
17- "build" : "Python Demo" , # Change your build name here
18- "name" : "Python Demo Test" , # Change your test name here
19- "platformName" : "Windows 11" ,
20- "selenium_version" : "4.0.0" ,
21- "console" : 'true' , # Enable or disable console logs
22- "network" : 'true' , # Enable or disable network logs
23- #Enable Smart UI Project
24- #"smartUI.project": "<Project Name>"
25- },
26- "browserName" : "firefox" ,
27- "browserVersion" : "latest" ,
28- }
11+ #paste your capibility options below
12+
13+ options = ChromeOptions ()
14+ options .browser_version = "114.0"
15+ options .platform_name = "macOS High Sierra"
16+ lt_options = {}
17+ lt_options ["username" ] = username
18+ lt_options ["accessKey" ] = access_key
19+ lt_options ["video" ] = True
20+ lt_options ["resolution" ] = "1920x1080"
21+ lt_options ["network" ] = True
22+ lt_options ["build" ] = "test_build"
23+ lt_options ["project" ] = "unit_testing"
24+ lt_options ["smartUI.project" ] = "test"
25+ lt_options ["name" ] = "basic_unit_selinium"
26+ lt_options ["w3c" ] = True
27+ lt_options ["plugin" ] = "python-python"
28+ options .set_capability ('LT:Options' , lt_options )
29+
2930
3031 # Steps to run Smart UI project (https://beta-smartui.lambdatest.com/)
3132 # Step - 1 : Change the hub URL to @beta-smartui-hub.lambdatest.com/wd/hub
3233 # Step - 2 : Add "smartUI.project": "<Project Name>" as a capability above
3334 # Step - 3 : Run "driver.execute_script("smartui.takeScreenshot")" command wherever you need to take a screenshot
3435 # Note: for additional capabilities navigate to https://www.lambdatest.com/support/docs/test-settings-options/
3536
36- self .driver = webdriver .Remote (
37- command_executor = "http://{}:{}@hub.lambdatest.com/wd/hub" .format (
38- username , access_key ),
39- desired_capabilities = desired_caps )
37+ driver = webdriver .Remote (
38+ command_executor = "http://{}:{}@beta-smartui-hub.lambdatest.com/wd/hub" .format (
39+ username , access_key ),options = options )
4040
4141# tearDown runs after each test case
4242
@@ -90,4 +90,4 @@ def test_demo_site(self):
9090
9191
9292if __name__ == "__main__" :
93- unittest .main ()
93+ unittest .main ()
0 commit comments