Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1ac1994

Browse files
Merge pull request #11 from passionatedevtester/patch-2
Update lambdatest_test.py
2 parents dab64e3 + 8be56c1 commit 1ac1994

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

‎lambdatest_test.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import unittest
33
import sys
44
from selenium import webdriver
5+
from selenium.webdriver.chrome.options import Options as ChromeOptions
6+
from selenium.webdriver.edge.options import Options as EdgeOptions
7+
from selenium.webdriver.common.by import By
58

69
username = os.environ.get("LT_USERNAME")
710
access_key = os.environ.get("LT_ACCESS_KEY")
@@ -11,21 +14,21 @@ class FirstSampleTest(unittest.TestCase):
1114

1215
# setUp runs before each test case
1316
def setUp(self):
14-
desired_caps = {
15-
'LT:Options': {
16-
"user": username,
17-
"accessKey": access_key,
18-
"build": "UnitTest-Selenium-Sample",
19-
"name": "UnitTest-Selenium-Test",
20-
"platformName": "Windows 11",
21-
"selenium_version": "4.0.0",
22-
#Enable Smart UI Project
23-
# "smartUI.project": "<Project Name>",
24-
},
25-
"browserName": "Chrome",
26-
"browserVersion": "latest",
17+
lt_options = {
18+
"user": username,
19+
"accessKey": access_key,
20+
"build": "UnitTest-Selenium-Sample",
21+
"name": "UnitTest-Selenium-Test",
22+
"platformName": "MacOS Ventura",
23+
"w3c": True,
24+
"browserName": "Edge",
25+
"browserVersion": "latest-2",
26+
"selenium_version": "4.8.0"
2727
}
28-
28+
29+
browser_options = EdgeOptions()
30+
browser_options.set_capability('LT:Options', lt_options)
31+
2932
# Steps to run Smart UI project (https://beta-smartui.lambdatest.com/)
3033
# Step - 1 : Change the hub URL to @beta-smartui-hub.lambdatest.com/wd/hub
3134
# Step - 2 : Add "smartUI.project": "<Project Name>" as a capability above
@@ -34,7 +37,7 @@ def setUp(self):
3437

3538
self.driver = webdriver.Remote(
3639
command_executor="http://hub.lambdatest.com:80/wd/hub",
37-
desired_capabilities=desired_caps)
40+
options=browser_options)
3841

3942

4043
# tearDown runs after each test case
@@ -50,26 +53,26 @@ def test_unit_user_should_able_to_add_item(self):
5053
driver.get("https://lambdatest.github.io/sample-todo-app/")
5154

5255
# Click on check box
53-
check_box_one = driver.find_element_by_name("li1")
56+
check_box_one = driver.find_element(By.NAME,"li1")
5457
check_box_one.click()
5558

5659
# Click on check box
57-
check_box_two = driver.find_element_by_name("li2")
60+
check_box_two = driver.find_element(By.NAME,"li2")
5861
check_box_two.click()
5962

6063
#Take Smart UI screenshot
6164
#driver.execute_script("smartui.takeScreenshot")
6265

6366
# Enter item in textfield
64-
textfield = driver.find_element_by_id("sampletodotext")
67+
textfield = driver.find_element(By.ID,"sampletodotext")
6568
textfield.send_keys("Yey, Let's add it to list")
6669

6770
# Click on add button
68-
add_button = driver.find_element_by_id("addbutton")
71+
add_button = driver.find_element(By.ID,"addbutton")
6972
add_button.click()
7073

7174
# Verified added item
72-
added_item = driver.find_element_by_xpath(
75+
added_item = driver.find_element(By.XPATH,
7376
"//span[@class='done-false']").text
7477
print(added_item)
7578

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /