find_element_by_name() method would fit here:

driver.find_element_by_name("quantity")
Answer from alecxe on Stack Overflow
🌐
Selenium Python
selenium-python.readthedocs.io › locating-elements.html
4. Locating Elements — Selenium Python Bindings 2 documentation
find_element(By.ID, "id") find_element(By.NAME, "name") find_element(By.XPATH, "xpath") find_element(By.LINK_TEXT, "link text") find_element(By.PARTIAL_LINK_TEXT, "partial link text") find_element(By.TAG_NAME, "tag name") find_element(By.CLASS_NAME, "class name") find_element(By.CSS_SELECTOR, ...
🌐
Selenium
selenium.dev › documentation › webdriver › elements › finders
Finding web elements | Selenium
September 6, 2025 - In our example HTML above, there are two elements that have a class name of “tomatoes” so this method will return the element in the “vegetables” list. Move Code · Java · Python · CSharp · Ruby · JavaScript · Kotlin · WebElement vegetable = driver.findElement(By.className("tomatoes")); vegetable = driver.find_element(By.CLASS_NAME, "tomatoes") var vegetable = driver.FindElement(By.ClassName("tomatoes")); fruits = driver.find_element(id: 'fruits') fruits.find_element(class: 'tomatoes') View Complete Code View on GitHub ·
Discussions

Selenium Python 2 find element by name and value? - Stack Overflow
I have been trying to locate an element on a web page, this element has the same name as other elements and no id. It does have a different value, so I would like to find the element by the name AN... More on stackoverflow.com
🌐 stackoverflow.com
April 25, 2017
Finding Element by Name Attribute in Selenium Python - LambdaTest Community
How to find an element by its name attribute using Selenium in Python? Below is my HTML file and code where i am trying to get the attribute name More on community.lambdatest.com
🌐 community.lambdatest.com
0
February 22, 2024
Why does the driver.find_element_by_name() methode not work?
The reason why it's garbled like "YPqjbf" and not "this_readable_name" is because it's a dynamic value not meant to be used as a static reference. You should navigate through relational properties, eg each form segment is inside a role="listitem" div, then the form entry div is that div's only great grandchild with a jsaction property. More on reddit.com
🌐 r/learnpython
7
0
February 23, 2023
Super new to selenium, Occuring an error while trying to find element by name
It says to use By, not by. More on reddit.com
🌐 r/learnpython
2
3
March 6, 2022
🌐
GeeksforGeeks
geeksforgeeks.org › python › find_element_by_name-driver-method-selenium-python
find_element(By.Name) driver method - Selenium Python - GeeksforGeeks
July 12, 2025 - How to use driver.find_element_by_name() method in Selenium? Let's try to practically implement this method and get an element instance for "https://www.geeksforgeeks.org/". Let's try to grab search form input using its name "search".
🌐
Readthedocs
selenium-python-test.readthedocs.io › en › latest › locating-elements.html
4. Locating Elements — Selenium Python Bindings 2 documentation
from selenium.webdriver.common.by import By driver.find_element(By.XPATH, '//button[text()="Some text"]') driver.find_elements(By.XPATH, '//button') ... ID = "id" XPATH = "xpath" LINK_TEXT = "link text" PARTIAL_LINK_TEXT = "partial link text" NAME = "name" TAG_NAME = "tag name" CLASS_NAME = "class name" CSS_SELECTOR = "css selector"
🌐
GitHub
iqss.github.io › dss-webscrape › finding-web-elements.html
4 Finding Web Elements | Web Scraping Using Selenium Python
Similar to XPath, Selenium can leverage and use CSS selectors to find elements on a web page. In our previous example, in which we wanted to get the search button on the example site, we can use the following selector, where the selector is defined as the element tag along with the class name. This will find an <input> element with the "btn-default" class name. We then test it by ...
🌐
Python Examples
pythonexamples.org › python-selenium-find-element-by-name
How to Find Element by Name in Selenium Python?
To find an HTML Element by name attribute using Selenium in Python, call find_element() method and pass By.NAME as the first argument, and the name attribute's value (of the HTML Element we need to find) as the second argument.
Find elsewhere
🌐
BrowserStack
browserstack.com › home › guide › locators in selenium: a detailed guide
Locators in Selenium: A Detailed Guide | BrowserStack
September 26, 2024 - The .find_element_by_class_name() method only returns the first element with the matching class. It raises a NoSuchElementException if no element exists with the given class name.
🌐
ScrapingAnt
scrapingant.com › blog › selenium-python-find-element
How to Find Elements With Selenium in Python | ScrapingAnt
July 29, 2024 - If no element with the specified ID is found, Selenium will raise a NoSuchElementException. The find_element_by_name method locates the first element with the given name attribute.
🌐
Selenium
selenium.dev › blog › 2022 › python-locators-se4
Locate your locators - Python bindings changes upcoming | Selenium
August 9, 2022 - If you’re really desperate however you can use strings instead of the By object: driver.find_element('id', "submit_button").click() driver.find_element('css selector', '.myelement child').text · If you have any plans to upgrade your Selenium client for your Python tests to recent versions of Selenium 4, definitely keep these changes in mind.
🌐
Python Basics
pythonbasics.org › selenium-find-element
selenium find element by id - Python Tutorial
The Python code below uses selenium to find al the list items, li, on a webpage. Selenium can find an element by name instead of code.
🌐
Katalon
katalon.com › blog › insights › find elements in selenium with python: a complete guide
Find Elements in Selenium with Python: A Complete Guide
February 5, 2026 - Mastering element identification in Selenium with Python is foundational for building robust and reliable web automation. By effectively employing a variety of locator strategies and adhering to best practices for stable test execution, teams ensure precise and consistent interactions with web elements, leading to more resilient and efficient automated tests. Employ Diverse Locator Strategies: Utilize `By.ID`, `By.NAME`, `By.CLASS_NAME`, `By.TAG_NAME`, `By.LINK_TEXT`, `By.PARTIAL_LINK_TEXT`, `By.CSS_SELECTOR`, and `By.XPATH` to accurately pinpoint web elements based on their attributes and DOM structure for comprehensive discovery and interaction.
🌐
Endtest
endtest.io › blog › a-practical-guide-for-finding-elements-with-selenium
A practical Guide for Finding Elements with Selenium | Finding elements in Selenium can be tricky, here is practical guide to finding them and a comparison with Endtest. | Endtest
username = driver.find_element_by_class_name("form-control") This means that the you won't be able to locate that Username input with the Class Name locator type, since Selenium will throw an error.
🌐
TechBeamers
techbeamers.com › locate-elements-selenium-python
Python Selenium Locate Elements - TechBeamers
November 30, 2025 - get_div = driver.find_element_by_class_name('round-button') Today, you learned eight locator types and how to use them in Selenium Python.
🌐
LambdaTest
lambdatest.com › blog › how-to-use-name-locator-in-selenium-automation-scripts
How To Use Name Locator In Selenium Automation Scripts? | LambdaTest
April 15, 2024 - A key point to note is when you tend to select an element with a desired name attribute value, it will select the first element it encounters. You may come across another scenario, where you wish to select elements with the same name attribute value, in this case, the By.name locator in Selenium may work using the findElements syntax.
🌐
LambdaTest Community
community.lambdatest.com › general discussions
Finding Element by Name Attribute in Selenium Python - LambdaTest Community
February 22, 2024 - How to find an element by its name attribute using Selenium in Python? Below is my HTML file and code where i am trying to get the attribute name ``` inputElement = driver.find_element_by_id("quantity")
🌐
BrowserStack
browserstack.com › home › guide › how to find elements in selenium with python: id, xpath, css, and more
Find Elements in Selenium with Python: ID, XPath, CSS, & More | BrowserStack
January 28, 2025 - # With the help of exact text link ... location elements in Selenium with Python: Use Unique Identifiers as they are the most stable and reliable method for element identification....
🌐
PyTutorial
pytutorial.com › python-selenium-finding-elements-by-name
PyTutorial | Python Selenium: Finding Elements by Name
October 22, 2024 - To get started with Selenium setup, you might find our guide on Installation and Setup of Selenium with Python helpful. To find an element by its name, use the find_element method with By.NAME.
🌐
Apify
blog.apify.com › selenium-find-elements
Python guide: Selenium element locators
May 26, 2025 - In this syntax, By.locator_strategy specifies the method for locating the element (such as ID, class name, or XPath). Selenium provides several built-in locator strategies, including: ... Also, the locator strategy requires a locator value to uniquely identify the web element. Now, if you want to use ID as the locator strategy to identify an element, you would write: ... As you can see, ID is the locator strategy, and "elementId" is the locator value, which you can find by inspecting the HTML of the webpage and locating the id attribute of the target element.