input: Write a function to create a web scraper using Python’s Selenium that retrieves data from an online store. The function should initialize a Firefox session, navigate to a specified URL, perform a search, and print the names of the products displayed on the result page. If the provided URL is invalid or the search fails, the function should handle the error gracefully.
  
  def web_scraper(url, search_keyword):
      from selenium import webdriver
  
      # create a new Firefox session
      driver = webdriver.Firefox()
      driver.implicitly_wait(30)
      driver.maximize_window()
  
      # navigate to the application home page
      driver.get(url)
  
      try:
          # get the search textbox
          search_field = driver.find_element_by_name("q")
          search_field.clear()
  
          # enter search keyword and submit
          search_field.send_keys(search_keyword)
          search_field.submit()
  
          # get the list of elements which are displayed after the search
          # currently on result page using find_elements_by_class_name
          product_list = driver.find_elements_by_class_name("product")
  
          # iterate through each element and print the text that is
          # name of the product
          for product in product_list:
              print(product.text)
  
      except Exception as e:
          print(f"An error occurred: {e}")
  
      finally:
          # close the browser window
          driver.quit()
  
  assert web_scraper("https://www.example.com/", "shoes") == None
  assert web_scraper("https://www.invalidurl.com/", "shoes") == None
  assert web_scraper("https://www.example.com/", "electronics") == None
output: def web_scraper(url, search_keyword):
      from selenium import webdriver
  
      # create a new Firefox session
      driver = webdriver.Firefox()
      driver.implicitly_wait(30)
      driver.maximize_window()
  
      # navigate to the application home page
      driver.get(url)
  
      try:
          # get the search textbox
          search_field = driver.find_element_by_name("q")
          search_field.clear()
  
          # enter search keyword and submit
          search_field.send_keys(search_keyword)
          search_field.submit()
  
          # get the list of elements which are displayed after the search
          # currently on result page using find_elements_by_class_name
          product_list = driver.find_elements_by_class_name("product")
  
          # iterate through each element and print the text that is
          # name of the product
          for product in product_list:
              print(product.text)
  
      except Exception as e:
          print(f"An error occurred: {e}")
  
      finally:
          # close the browser window
          driver.quit()