|
@@ -1,30 +1,28 @@
|
|
|
-# Generated Test Script
|
|
|
-import time
|
|
|
+# Automation Test Script Template
|
|
|
+
|
|
|
+# 1. Import required Selenium libraries and other dependencies
|
|
|
from selenium import webdriver
|
|
|
-from selenium.webdriver.common.by import By
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
|
|
|
-# Define the test scenario
|
|
|
-test_scenario = "Login Test for Application"
|
|
|
+# 2. Define the test scenario
|
|
|
+test_scenario = "Login Test for <Application Name>"
|
|
|
|
|
|
-# Set up WebDriver
|
|
|
+# 3. Set up WebDriver
|
|
|
driver = webdriver.Chrome()
|
|
|
|
|
|
-# Navigate to the target webpage
|
|
|
+# 4. Navigate to the target webpage
|
|
|
driver.get("http://example.com/login")
|
|
|
|
|
|
-# Locate and interact with elements
|
|
|
-username_field = driver.find_element(By.ID, "username")
|
|
|
+# 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 = driver.find_element_by_id("password")
|
|
|
password_field.send_keys("test_password")
|
|
|
|
|
|
-login_button = driver.find_element(By.ID, "loginButton")
|
|
|
+login_button = driver.find_element_by_id("loginButton")
|
|
|
login_button.click()
|
|
|
|
|
|
-# Print completion time
|
|
|
-print(f"Test completed at: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
|
|
-
|
|
|
-# Close the browser
|
|
|
-driver.quit()
|
|
|
+# Please print completion date and time
|
|
|
+import datetime
|
|
|
+print(f"Completion Time: {datetime.datetime.now()}")
|