input: Write a function to generate a Selenium script that automates the login process for a given website. The function should take the target website URL, username, and password as input parameters. It should initialize a webdriver, locate the username and password fields, enter the credentials, click the submit button, and print a success message if the login is successful. If the target website URL is empty, the function should return an error message.
  
  
  from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  import time
  
  def automate_login(target_url, username_value, password_value):
      if not target_url:
          return "Error: Target website URL is empty."
      
      # Initialize web driver
      driver = webdriver.Chrome()
      
      # Navigate to the target web page
      driver.get(target_url)
      
      # Locate username field
      username = driver.find_element_by_name('username')
      
      # Enter username
      username.send_keys(username_value)
      
      # Locate password field
      password = driver.find_element_by_name('password')
      
      # Enter password
      password.send_keys(password_value)
      
      # Locate submit button
      submit_button = driver.find_element_by_name('submit')
      
      # Click submit button
      submit_button.click()
      
      # Wait for login process to complete
      time.sleep(5)
      
      # Login successful
      success_message = 'Login successful!'
      print(success_message)
      
      driver.close()
      
      return success_message
  
  # Test cases
  assert automate_login('http://www.example.com', 'user123', 'pass123') == 'Login successful!'
  assert automate_login('', 'user123', 'pass123') == 'Error: Target website URL is empty.'
  
output: def automate_login(target_url, username_value, password_value):
      if not target_url:
          return "Error: Target website URL is empty."
      
      # Initialize web driver
      driver = webdriver.Chrome()
      
      # Navigate to the target web page
      driver.get(target_url)
      
      # Locate username field
      username = driver.find_element_by_name('username')
      
      # Enter username
      username.send_keys(username_value)
      
      # Locate password field
      password = driver.find_element_by_name('password')
      
      # Enter password
      password.send_keys(password_value)
      
      # Locate submit button
      submit_button = driver.find_element_by_name('submit')
      
      # Click submit button
      submit_button.click()
      
      # Wait for login process to complete
      time.sleep(5)
      
      # Login successful
      success_message = 'Login successful!'
      print(success_message)
      
      driver.close()
      
      return success_message