1
1
2
2
import unittest
3
- import time
4
3
import os
5
4
from selenium import webdriver
6
5
from selenium .webdriver .common .by import By
@@ -56,47 +55,39 @@ def test_demo_site(self):
56
55
57
56
# Url
58
57
print ('Loading URL' )
59
- driver .get ("https://stage-demo .lambdatest.com/ " )
58
+ driver .get ("https://todo-app .lambdatest.io/index.html " )
60
59
61
- # Let's select the location
62
- driver .find_element (By .ID , "headlessui-listbox-button-1 " ).click ()
63
- location = driver .find_element (By .ID , "Bali " )
60
+ # Let's click on a element
61
+ driver .find_element (By .NAME , "li1 " ).click ()
62
+ location = driver .find_element (By .NAME , "li2 " )
64
63
location .click ()
65
- print ("Location is selected as Bali. " )
64
+ print ("Clicked on the second element " )
66
65
67
66
#Take Smart UI screenshot
68
67
#driver.execute_script("smartui.takeScreenshot")
69
68
70
- # Let's select the number of guests
71
- driver .find_element (By .ID , "headlessui-listbox-button-5 " ).click ( )
72
- guests = driver .find_element (By .ID , "2 " )
73
- guests .click ()
74
- print ("Number of guests are selected. " )
69
+ # Let's add a checkbox
70
+ driver .find_element (By .ID , "sampletodotext " ).send_keys ( "LambdaTest" )
71
+ add_button = driver .find_element (By .ID , "addbutton " )
72
+ add_button .click ()
73
+ print ("Added LambdaTest checkbox " )
75
74
76
- # Searching for the results
77
- search = driver .find_element (By .XPATH , "//*[@id='search']" )
78
- assert search .is_displayed (), "Search is not displayed"
75
+ # print the heading
76
+ search = driver .find_element (By .CSS_SELECTOR , ".container h2" )
77
+ assert search .is_displayed (), "heading is not displayed"
78
+ print (search .text )
79
79
search .click ()
80
80
driver .implicitly_wait (3 )
81
81
82
- # Let's select one of the hotels for booking
83
- reserve = driver .find_element (By .ID , "reserve-now" )
84
- reserve .click ()
85
- driver .implicitly_wait (3 )
86
- proceed = driver .find_element (By .ID , "proceed" )
87
- proceed .click ()
88
- driver .implicitly_wait (3 )
89
- print ("Booking is confirmed." )
90
-
91
82
# Let's download the invoice
92
- download = driver .find_element (By .ID , "invoice " )
93
- if ( download .is_displayed () ):
94
- download .click ()
83
+ heading = driver .find_element (By .CSS_SELECTOR , ".container h2 " )
84
+ if heading .is_displayed ():
85
+ heading .click ()
95
86
driver .execute_script ("lambda-status=passed" )
96
87
print ("Tests are run successfully!" )
97
88
else :
98
89
driver .execute_script ("lambda-status=failed" )
99
90
100
91
101
92
if __name__ == "__main__" :
102
- unittest .main ()
93
+ unittest .main ()
0 commit comments