Skip to content

Commit dabf269

Browse files
added sync true sample
1 parent 66c7dc2 commit dabf269

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

SmartUI_SDK_LT_hub_sync.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from lambdatest_selenium_driver import smartui_snapshot
2+
import unittest
3+
from selenium import webdriver
4+
from selenium.webdriver.common.by import By
5+
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
6+
import os
7+
8+
username = os.getenv("LT_USERNAME") # Replace the username
9+
access_key = os.getenv("LT_ACCESS_KEY") # Replace the access key
10+
class FirstSampleTest(unittest.TestCase):
11+
def setUp(self):
12+
options = webdriver.ChromeOptions()
13+
options.browser_version = "118.0"
14+
options.platform_name = "Windows 11"
15+
lt_options = {};
16+
lt_options["resolution"] = "1024x768";
17+
lt_options["project"] = "Python_SDK";
18+
lt_options["name"] = "Python_Build";
19+
lt_options["w3c"] = True;
20+
lt_options["plugin"] = "python-python";
21+
lt_options["console"] = True
22+
lt_options["network"] = True
23+
lt_options["selenium_version"] = "4.0.0"
24+
options.set_capability('LT:Options', lt_options);
25+
self.driver = webdriver.Remote(
26+
command_executor="http://{}:{}@hub.lambdatest.com/wd/hub".format(
27+
username, access_key),
28+
options=options
29+
)
30+
def tearDown(self):
31+
self.driver.quit()
32+
def test_demo_site(self):
33+
driver = self.driver
34+
driver.implicitly_wait(10)
35+
driver.set_page_load_timeout(30)
36+
print('Loading URL')
37+
driver.get("https://www.lambdatest.com/")
38+
config = {
39+
"sync": True
40+
}
41+
response = smartui_snapshot(driver,"1st SS",config)
42+
assert response["snapshotName"] == "1st SS"
43+
assert response["error"] == ""
44+
assert len(response["screenshots"]) == 14
45+
46+
if __name__ == "__main__":
47+
unittest.main()

0 commit comments

Comments
 (0)