from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Chrome()
driver.implicitly_wait(5)
driver_waite= WebDriverWait(driver,20)
driver.maximize_window()

driver.get("https://www.amazon.com/")

SING_IN_WINDOW = (By.ID, "nav-signin-tooltip")
SING_IN_WINDOW_MENU= (By.CSS_SELECTOR, "a#nav-link-accountList")
FIND_GIFT = (By.CSS_SELECTOR, "a[href*='nav_cs_giftfinder']")
COUPONS = (By.CSS_SELECTOR, "a[href*='nav_cs_coupons']")
TEX_IN_CUPONS = (By.CSS_SELECTOR,"div.bxw-pageheader__title__text")
YOUR_LIST_MENU = (By.ID, "nav-al-wishlist")

#window = driver.find_element(*SING_IN_WINDOW)
#waite antill sing window desapire
driver_waite.until(EC.invisibility_of_element_located ((SING_IN_WINDOW)))

# clik on cupons an chack the text "Amazon Coupons" is here
driver.find_element(*COUPONS).click()
text = driver.find_element(*TEX_IN_CUPONS).text
assert "Amazon Coupons" == text, f'Expected text "Amazon Coupons", but got {text}'

# muve the mouse to "SING_IN" fild and check menu is here
SING_IN_FILD = driver.find_element(*SING_IN_WINDOW_MENU)
actions = ActionChains(driver)
fild = actions.move_to_element(SING_IN_FILD)
menu = driver.find_elements(*YOUR_LIST_MENU)
for text in menu:
    print (text)
actions.perform()

driver.quit()