1

I want to use Selenium for automate a login in the website https://clientes.ecuabots.com/user/login

This is my code:

class EcuabotsTest(unittest.TestCase):

def setUp(self):
    self.driver =  webdriver.Chrome(executable_path='/mnt/c/Users/Barbara/Documents/Formación Continua/Selenium/chromedriver.exe')
    driver = self.driver
    driver.get('https://clientes.ecuabots.com/user/login')
    driver.maximize_window()
    #driver.implicitly_wait(15)

def test_search_email_input(self):
    email_field = self.driver.find_elements_by_xpath('//*[@id="input-15"]')
    email_field.clear()
    
    email_field.send_keys('[email protected])



if __name__ == "__main__":
    unittest.main(verbosity=2)

but when i try this way i have the error: AttributeError 'list' object has no attribute send_keys

  • I tried to use email_field = self.driver.find_element_by_xpath('//[@id="input-15"]') (singular) but i get this error: selenium.common.exceptions.NoSuchElementException: Message: No such element: {"method":"xpath","selector":"//[@id="input-15"]"

  • I tried the find email input with id, CSS selector and full XPath but it isn't work

  • I tried to use email_field[0].send_keys('[email protected]) but i get the first error again

Thank you very much beforehand for your help!

1 Answer 1

1
  1. You have to wait until the page is loaded and the element is presented there
  2. You should use find_element_by_xpath, not find_elements_by_xpath
  3. Your locator is wrong

Try this:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

email_input_css = 'input[placeholder="Email Address"]'

wait = WebDriverWait(browser, 20)

email = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, email_input_css)))
email_field.clear()
email_field.send_keys('[email protected])

Sign up to request clarification or add additional context in comments.

1 Comment

You can use any element attributes values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.