Guilherme Lima Guilherme Lima - 11 days ago 5
Python Question

ElementNotVisibleException Selenium

Estou tentando fazer o login no site www.pactpub.com
I trying to make a login with selenium on https://www.packtpub.com/

i trying this:

def setUp(self):

self.driver = webdriver.Chrome(executable_path='C:\_workspace\projects\Packtpub\chromedriver')
self.driver.get("https://www.packtpub.com")
time.sleep(5) # Let the user actually see something!


def test_login(self):

driver = self.driver
driver.maximize_window()

login1 = driver.find_element_by_id("email-wrapper")
login1.find_element_by_id("email").send_keys("my_login")


so return this error:


ElementNotVisibleException: Message: element not visible


I don't know why

Answer

The problem is that there are 2 elements with id="email" on page (try driver.find_elements_by_id("email") and you will see it). So you should try

driver.find_elements_by_id("email")[1].send_keys("my_login")