0

im stuck trying to input email and pass on a web page. I toke xpath from email input but when I execute the code I get a error in the consol.

  import time
from datetime import date
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options

options = Options()

browser = webdriver.Chrome('C:/chromedriver.exe',chrome_options=options)
browser.get('https://app.buenbit.com/dashboard')

usuario = browser.find_element_by_xpath('//*[@id="root"]/div/div[3]/div[1]/form/div[1]/input')


browser.quit()

this is the error

Traceback (most recent call last): File "c:/proyectos/SCRAPY/MercadoLibre HIDE.py", line 12, in usuario = browser.find_element_by_xpath('//[@id="root"]/div/div[3]/div[1]/form/div[1]/input') File "C:\Users\vrodrig5\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Users\vrodrig5\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\vrodrig5\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\vrodrig5\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//[@id="root"]/div/div[3]/div[1]/form/div[1]/input"} (Session info: chrome=81.0.4044.138)

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

1

To login within the website https://app.buenbit.com/ using a valid set of credentials you need to induce WebDriverWait for the desired element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    driver.get("https://app.buenbit.com/")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='email']"))).send_keys("Victor_Rodriguez")
    
  • Using XPATH:

    driver.get("https://app.buenbit.com/")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='email']"))).send_keys("Victor_Rodriguez")
    
  • Browser Snapshot:

buenbit

  • Note : You have to add the following imports:

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352