I'm learning automation and I have a few set of login IDs and I'm trying to login and logout in amazon.com website and with a set of login IDs and password which are in a excel file.
Issue what I'm facing is to figure out how to hover over the "hello" in the amazon home page and click on login. I have tried mouse_hover(), click using XPath. However what I want to do is that after I get into the login page I want to login using different login ID and logout again and do the same with different login ID/password.
Here's the code I'm trying to do.
import unittest
from selenium import webdriver
from selenium.webdriver.support.ui import Select
# create a new Firefox session
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.maximize_window()
# navigate to the application home page
driver.get("http://www.amazon.com/")
if 'Sign Out' in driver.page_source:
pass
else:
mouse_over("//*[@id='nav-link-yourAccount]")
hover = driver.find_element_by_xpath("//*[@id='nav-link-yourAccount]")
hover.click()
logi = driver.find_element_by_xpath("//*[@id='nav-flyout-ya-signin']")
logi.click()
# username = driver.find_element_by_id("login_login_username")
# username.send_keys("student2")
# password= driver.find_element_by_id("login_login_password")
# password.send_keys("Testing1")
# loginbutton=driver.find_element_by_id("login_submit")
# loginbutton.click()