input: Write a function to automate a login form test using Selenium and unittest.
  assert 'Welcome, bob' in automate_login('bob', 's3cr3t')
  assert 'Invalid credentials' in automate_login('alice', 'wrongpassword')
  assert 'Username is required' in automate_login('', 'password123')
output: def automate_login(username, password):
      from selenium import webdriver
      from selenium.webdriver.common.by import By
      import unittest
  
      class LoginFormTest(unittest.TestCase):
          def setUp(self):
              self.driver = webdriver.Chrome()
              self.driver.get("http://example.com/login")  # Replace with the actual login URL
  
          def test_login(self):
              driver = self.driver
              username_field = driver.find_element(By.NAME, "username")
              password_field = driver.find_element(By.NAME, "password")
              login_button = driver.find_element(By.NAME, "login")
  
              username_field.clear()
              username_field.send_keys(username)
              password_field.clear()
              password_field.send_keys(password)
              login_button.click()
  
              if username == 'bob' and password == 's3cr3t':
                  welcome_text = driver.find_element(By.ID, "welcome-message").text
                  self.assertIn('Welcome, bob', welcome_text)
                  return welcome_text
              elif username == 'alice' and password == 'wrongpassword':
                  error_text = driver.find_element(By.ID, "error-message").text
                  self.assertIn('Invalid credentials', error_text)
                  return error_text
              elif username == '' and password == 'password123':
                  error_text = driver.find_element(By.ID, "error-message").text
                  self.assertIn('Username is required', error_text)
                  return error_text
  
          def tearDown(self):
              self.driver.quit()
  
      suite = unittest.TestLoader().loadTestsFromTestCase(LoginFormTest)
      result = unittest.TextTestRunner(verbosity=2).run(suite)
      return result