11
22import unittest
3- import time
43import os
54from selenium import webdriver
65from selenium .webdriver .common .by import By
@@ -56,47 +55,39 @@ def test_demo_site(self):
5655
5756 # Url
5857 print ('Loading URL' )
59- driver .get ("https://stage-demo .lambdatest.com/ " )
58+ driver .get ("https://todo-app .lambdatest.io/index.html " )
6059
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 " )
6463 location .click ()
65- print ("Location is selected as Bali. " )
64+ print ("Clicked on the second element " )
6665
6766 #Take Smart UI screenshot
6867 #driver.execute_script("smartui.takeScreenshot")
6968
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 " )
7574
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 )
7979 search .click ()
8080 driver .implicitly_wait (3 )
8181
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-
9182 # 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 ()
9586 driver .execute_script ("lambda-status=passed" )
9687 print ("Tests are run successfully!" )
9788 else :
9889 driver .execute_script ("lambda-status=failed" )
9990
10091
10192if __name__ == "__main__" :
102- unittest .main ()
93+ unittest .main ()
0 commit comments