|
@@ -1,28 +1,12 @@
|
|
|
-# Automation Test Script
|
|
|
+# Automation Test Script Template
|
|
|
|
|
|
# 1. Import required Selenium libraries and other dependencies
|
|
|
from selenium import webdriver
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
-
|
|
|
-# 2. Define the test scenario
|
|
|
-test_scenario = "Login Test for Example Application"
|
|
|
-
|
|
|
-# 3. Set up WebDriver
|
|
|
-driver = webdriver.Chrome()
|
|
|
-
|
|
|
-# 4. Navigate to the target webpage
|
|
|
-driver.get("http://example.com/login")
|
|
|
-
|
|
|
-# 5. Locate and interact with elements
|
|
|
-username_field = driver.find_element_by_id("username")
|
|
|
-username_field.send_keys("test_user")
|
|
|
-
|
|
|
-password_field = driver.find_element_by_id("password")
|
|
|
-password_field.send_keys("test_password")
|
|
|
-
|
|
|
-login_button = driver.find_element_by_id("loginButton")
|
|
|
-login_button.click()
|
|
|
-
|
|
|
-# Please print completion date and time
|
|
|
-import datetime
|
|
|
-print(f"Completion Date and Time: {datetime.datetime.now()}")
|
|
|
+import time
|
|
|
+import unittest
|
|
|
+from selenium.webdriver.support.ui import WebDriverWait
|
|
|
+from selenium.webdriver.support import expected_conditions as EC
|
|
|
+from selenium.webdriver.common.by import By
|
|
|
+# Add call to print_current_time at the end of the script
|
|
|
+print_current_time()
|