input: Write a function to automate the login process in a given website using Selenium in Python. The function should initialize a web driver, navigate to the target website, locate and fill in the username and password fields, click the submit button, and verify if the login was successful. If the login is successful, print 'Login successful!', otherwise handle the failure appropriately.
  
  
  from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  import time
  
  def automate_login(target_website, username_value, password_value):
      # Initialize web driver
      driver = webdriver.Chrome()
  
      try:
          # Navigate to the target web page
          driver.get(target_website)
  
          # 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)
  
          # Verify if login was successful
          if 'login successful' in driver.page_source.lower():
              print('Login successful!')
              return True
          else:
              print('Login failed!')
              return False
  
      except Exception as e:
          print(f'An error occurred during login: {str(e)}')
          return False
      finally:
          driver.close()
  
  # Test cases
  assert automate_login('http://www.example.com', 'username', 'password') == True
  assert automate_login('http://www.example.com', 'wrong_username', 'wrong_password') == False
  
output: def automate_login(target_website, username_value, password_value):
      driver = webdriver.Chrome()
      try:
          driver.get(target_website)
          username = driver.find_element_by_name('username')
          username.send_keys(username_value)
          password = driver.find_element_by_name('password')
          password.send_keys(password_value)
          submit_button = driver.find_element_by_name('submit')
          submit_button.click()
          time.sleep(5)
          if 'login successful' in driver.page_source.lower():
              print('Login successful!')
              return True
          else:
              print('Login failed!')
              return False
      except Exception as e:
          print(f'An error occurred during login: {str(e)}')
          return False
      finally:
          driver.close()