0
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
web = webdriver.Chrome()

web.get('https://id.pcgeducation.com/id093')
time.sleep(4)

user =  web.find_element(By.CLASS_NAME,"Name")
user.send_keys("aaaaaa@paaaas.com")

It is giving me the errors

Traceback (most recent call last):
  File "C:\Users\Bowie\PycharmProjects\AutomatedFormFilling\main.py", line 10, in <module>
    user =  web.find_element(By.CLASS_NAME,"Name")
  File "C:\Users\Bowie\PycharmProjects\AutomatedFormFilling\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 857, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "C:\Users\Bowie\PycharmProjects\AutomatedFormFilling\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Bowie\PycharmProjects\AutomatedFormFilling\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, 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"}
  (Session info: chrome=103.0.5060.134)

I really don't know what I am doing wrong with the find element class. Do I not have the correct PIP modules installed?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • It says `Unable to locate element: {"method":"css selector","selector":".Name"}` Is there an HTML element that has a class name of "Name" on the page you are hitting? – JNevill Aug 01 '22 at 21:15
  • Well I thought that the username box had a class of name but I will check that thank you – Michael Bowie Aug 01 '22 at 21:33
  • 1
    This is more of an html issue than python. It looks like you want to find the `` element of a `
    ` . However, what you have asked is to find any element with an attribute `class="Name"`. This question has a good answer with suggestions on how to find what you need - https://stackoverflow.com/a/67144322/529630
    – Dunes Aug 01 '22 at 21:39

0 Answers0