diff --git a/SmartUI_SDK_LT_hub_sync.py b/SmartUI_SDK_LT_hub_sync.py new file mode 100644 index 0000000..ab9dc44 --- /dev/null +++ b/SmartUI_SDK_LT_hub_sync.py @@ -0,0 +1,47 @@ +from lambdatest_selenium_driver import smartui_snapshot +import unittest +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities +import os + +username = os.getenv("LT_USERNAME") # Replace the username +access_key = os.getenv("LT_ACCESS_KEY") # Replace the access key +class FirstSampleTest(unittest.TestCase): + def setUp(self): + options = webdriver.ChromeOptions() + options.browser_version = "118.0" + options.platform_name = "Windows 11" + lt_options = {}; + lt_options["resolution"] = "1024x768"; + lt_options["project"] = "Python_SDK"; + lt_options["name"] = "Python_Build"; + lt_options["w3c"] = True; + lt_options["plugin"] = "python-python"; + lt_options["console"] = True + lt_options["network"] = True + lt_options["selenium_version"] = "4.0.0" + options.set_capability('LT:Options', lt_options); + self.driver = webdriver.Remote( + command_executor="http://{}:{}@hub.lambdatest.com/wd/hub".format( + username, access_key), + options=options + ) + def tearDown(self): + self.driver.quit() + def test_demo_site(self): + driver = self.driver + driver.implicitly_wait(10) + driver.set_page_load_timeout(30) + print('Loading URL') + driver.get("https://www.lambdatest.com/") + config = { + "sync": True + } + response = smartui_snapshot(driver,"1st SS",config) + assert response["snapshotName"] == "1st SS" + assert response["error"] == "" + assert len(response["screenshots"]) == 14 + +if __name__ == "__main__": + unittest.main()