# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestAutoLoginHulu():
  def setup_method(self, method):
    self.driver = webdriver.Chrome()
    self.vars = {}
  
  def teardown_method(self, method):
    self.driver.quit()
  
  def test_autoLoginHulu(self):
    self.driver.get("https://www.hulu.com/welcome")
    self.driver.set_window_size(1280, 800)
    WebDriverWait(self.driver, 30000).until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, ".navigation__login-button")))
    self.driver.find_element(By.CSS_SELECTOR, ".navigation__login-button").click()
    WebDriverWait(self.driver, 30000).until(expected_conditions.presence_of_element_located((By.ID, "email_id")))
    self.driver.find_element(By.ID, "email_id").send_keys(self.vars["usernameVar"])
    self.driver.find_element(By.ID, "password_id").send_keys(self.vars["passwordVar"])
    self.driver.find_element(By.CSS_SELECTOR, ".jsx-4164449555:nth-child(9)").click()
    if self.driver.execute_script("return (id=password_id)"):
      print(str("No good"))
    else:
      self.vars["self.vars["credentialsFound"] | Hulu"] = "self.vars["credentialsFound"]"
      print(str("I\'m in!!!!"))
  
