I am currently trying to learn selenium with python and I am having a lot of problems with the function:
browser.find_element_by_class_name('bob')
I have also tried using:
browser.find_element(By.CLASS_NAME, 'bob')
where 'bob' is the class name that I am trying to find, but it always returns the error code:
name "By" is not defined.
and if I remove "By" from the command, it always returns:
name "CLASS_NAME" is not defined.
So basically, I just want to call a class, but cannot seem to achieve this, and no matter where I look, I can't figure out how to write this. Sorry if I did anything wrong in this question, this is my first post to fullstack.
This is the complete code that I have used:
from selenium import webdriver
browser = webdriver.Edge()
browser.get('https://www.selenium.dev')
element = browser.find_element(By.CLASS_NAME, 'dropdown-item')
I have also tried:
from selenium import webdriver
browser = webdriver.Edge()
browser.get('https://www.selenium.dev')
browser.find_element_by_class_name('dropdown-item')
and I have tried both variations using "elements" instead of "element".
Can anyone help me out?