Python Forum
Get element (ID) from website to login
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get element (ID) from website to login
#1
Hi there,

Can you help me to get the element name from the website that I want to log-in to? I tried everything...:( I tried username, email, login-username, mat-input-0

Code for Python is:

from selenium import webdriver

browser = webdriver.Chrome()

browser.get("")

username = browser.find_element_by_name("")

username.click()

username.send_keys("")
Code from website element is

<input matinput type="email" formcontrolname="username" test-id="login-username" class="mat-input-element mat-form-field-autofill-control ng-tns-c185-3 cdk-text-field-autofill-monitored ng-pristine ng-invalid ng-touched" id="mat-input-0" placeholder="Username / email" aria-invalid="true" aria-required="false">
Im getting the error:
Error:
Traceback (most recent call last): File "login.py", line 32, in <module> username = browser.find_element_by_name("username") File "C:\Users\Example\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 496, in find_element_by_name return self.find_element(by=By.NAME, value=name) File "C:\Users\Example\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\Example\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Example\AppData\Local\Programs\Python\Python38-32\lib\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":"css selector","selector":"[name="username"]"} (Session info: chrome=84.0.4147.89)
Reply


Messages In This Thread
Get element (ID) from website to login - by Olimpiarob - Jul-26-2020, 06:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Login and download an exported csv file within a ribbon/button in a website Alekhya 0 2,616 Feb-26-2021, 04:15 PM
Last Post: Alekhya
  Seleniun does not work with a website element flote21 2 2,321 Jan-12-2021, 07:38 PM
Last Post: flote21
  Python Webscraping with a Login Website warriordazza 0 2,571 Jun-07-2020, 07:04 AM
Last Post: warriordazza
  Login to website kapibara 4 3,488 Jul-27-2019, 02:40 PM
Last Post: kapibara
  using webbot for website login fails loeten 2 6,351 Jan-03-2019, 07:31 AM
Last Post: loeten
  Login and access website mariolopes 7 9,143 Feb-07-2018, 09:47 AM
Last Post: mariolopes
  Using python requests module and BS4 to login on an Wordpress based website apollo 1 9,369 Feb-06-2018, 01:31 AM
Last Post: metulburr
  locating element with selenium after login sumandas89 1 3,605 Jan-15-2018, 02:40 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020