Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Get element (ID) from website to login
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()


username = browser.find_element_by_name("")

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:
Traceback (most recent call last): File "", 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\", 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\", 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\", 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\", 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)
what is the URL?
you seem to be missing a lot of code.
Suggest that you read (especially part 2 for selenium):
web scraping part 1
web scraping part 2
(Jul-26-2020, 09:41 PM)Larz60+ Wrote: what is the URL?
you seem to be missing a lot of code.
Suggest that you read (especially part 2 for selenium):
web scraping part 1
web scraping part 2

I know I'm missing some code ;) But I cant find the ID element. The URL is URL

When the side loades, it comes with somekind of pop-up, maybe there it goes wrong?

take the two tutorials, doesn't take much time at all, and all will become clear once you understand the basics.
You will be able to find your tag if it's there.

Why don't you try to use Selenium IDE from your brownser? It's a plugin from Selenium.

Start a new project a simulate what you need. After that, stop the Selenium IDE and check the item that you and to use.

Catch the xpath or id that it will give for you. Look the image that I attached here. But use the id or xpath:position.


Hope it can help you!


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Python Webscraping with a Login Website warriordazza 0 202 Jun-07-2020, 07:04 AM
Last Post: warriordazza
  Login to website kapibara 4 836 Jul-27-2019, 02:40 PM
Last Post: kapibara
  using webbot for website login fails loeten 2 2,702 Jan-03-2019, 07:31 AM
Last Post: loeten
  Login and access website mariolopes 7 2,886 Feb-07-2018, 09:47 AM
Last Post: mariolopes
  Using python requests module and BS4 to login on an Wordpress based website apollo 1 5,366 Feb-06-2018, 01:31 AM
Last Post: metulburr
  locating element with selenium after login sumandas89 1 1,727 Jan-15-2018, 02:40 PM
Last Post: metulburr

Forum Jump:

Users browsing this thread: 1 Guest(s)