I finally used get_attribute("value") as:

for i in browser.find_elements_by_xpath("//*[@type='submit']"):
    print i.get_attribute("value")
Answer from root on Stack Overflow
🌐
Selenium Python
selenium-python.readthedocs.io β€Ί 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')
🌐
Readthedocs
selenium-python-test.readthedocs.io β€Ί en β€Ί latest β€Ί locating-elements.html
4. Locating Elements β€” Selenium Python Bindings 2 documentation
continue = driver.find_element_by_name('continue') XPath is the language used for locating nodes in an XML document. As HTML can be an implementation of XML (XHTML), Selenium users can leverage this powerful language to target elements in their web applications.
Discussions

Python Selenium: Find object attributes using xpath - Stack Overflow
I am new to xpath, trying to get value of the "value" using xpath: while it is easy to find More on stackoverflow.com
🌐 stackoverflow.com
Using xpath to find element does not always work
While what has been said is correct, IDs and Name selectors are preferred, XPath can be easy to use if used correctly. I like using https://devhints.io/xpath as a guide, but you can actually build some fairly robust locators using xpath. For instance, a lot of buttons on a site I work with don't have ID or Name attributes. I've made some xpath locators like //input[@type="submit" and text() = "Save"] When using something like devtools, just right clicking an element and extracting the Xpath is going to give you a horribly long and hideous xpath locator - those are almost always going to break and are extremely brittle. You can use those for a quick proof of concept but for robust locators, that's generally what you want to avoid, but don't avoid xpath all together, because it can certainly make good locators. More on reddit.com
🌐 r/selenium
12
1
May 12, 2021
[selenium] How to find span in found element in selenium python
I don't know what the *ProductCard.div bit is doing, but you don't need it. self.driver.find_element(By.XPATH, '//span[text() = "Secure transaction"]').click() This should work. More on reddit.com
🌐 r/learnpython
7
1
November 2, 2022
Help with Selenium XPATH
Hey OP! If the site is constantly changing content then yes, it’s like that. Consider using either Selenium-Base which lets you record or playwright More on reddit.com
🌐 r/learnpython
3
3
July 1, 2022
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί find_element_by_xpath-driver-method-selenium-python
find_element(By.XPATH) driver method - Selenium Python - GeeksforGeeks
July 12, 2025 - Create a file called run.py to demonstrate the find_element(By.XPATH) method - ... # Python program to demonstrate # selenium # import webdriver from selenium import webdriver from selenium.webdriver.common.by import By # create webdriver object driver = webdriver.Firefox() # enter keyword to search keyword = "geeksforgeeks" # get geeksforgeeks.org driver.get("https://www.geeksforgeeks.org/") # get element element = driver.find_element(By.XPATH, "//form[input/@name ='search']") # print complete element print(element)
🌐
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
That's right, Class Names are separated by spaces. Selenium does not have a validation for that, but Endtest does: You simply can't avoid having to use XPath for at least some elements.
🌐
Roborabbit
roborabbit.com β€Ί blog β€Ί how-to-find-elements-by-xpath-in-selenium
How to Find Elements by XPath Using Selenium in Python
To locate an HTML element using an XPath expression, call the method with By.XPATH followed by the XPath expression in the parameter, for example: ... Make sure you have Selenium installed.
Find elsewhere
🌐
Selenium
selenium.dev β€Ί documentation β€Ί webdriver β€Ί elements β€Ί finders
Finding web elements | Selenium
September 6, 2025 - from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("https://www.example.com") ##get elements from parent element using TAG_NAME # Get element with tag name 'div' element = driver.find_element(By.TAG_NAME, 'div') # Get all the elements available with tag name 'p' elements = element.find_elements(By.TAG_NAME, 'p') for e in elements: print(e.text) ##get elements from parent element using XPATH ##NOTE: in order to utilize XPATH from current element, you must add "." to beginning of path # Get first element of tag 'ul' element = driver.find_element(By.XPATH, '//ul') # get children of tag 'ul' with tag 'li' elements = element.find_elements(By.XPATH, './/li') for e in elements: print(e.text)
🌐
Oxylabs
oxylabs.io β€Ί blog β€Ί selenium-find-element
How to Find Elements With Selenium in Python
When scraping with Selenium in Python, use tools like XPath Finder or Selenium IDE for accurate element location and explicit waits for dynamic content. Avoid common mistakes such as neglecting resource management and not using headless mode in production. In this blog post, we discussed various techniques for locating HTML elements using Selenium in Python, which is crucial for tasks like web scraping and automation. By ...
🌐
Testmuai
testmuai.com β€Ί testmu ai β€Ί blog β€Ί use cases of xpath python in selenium with examples | testmu ai
Use Cases of XPath Python In Selenium With Examples | TestMu AI (Formerly LambdaTest)
To find the location of a specific element in a document, you need to obtain the XPath of that element. For that, follow the steps: Inspect the website by right-clicking > Inspect or (ctrl + Shift + C or cmd + Option + C).
Published Β  December 25, 2025
🌐
H2K Infosys
h2kinfosys.com β€Ί blog β€Ί xpath contains, and or, parent, start with, axes in selenium webdriver
XPath Contains, AND OR, Parent, Start with, Axes in Selenium Webdriver | H2K Infosys Blog
December 15, 2025 - XPath Contains remains the most used and most powerful locator strategy in Selenium automation. XPath Contains helps locate dynamic or complex elements.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί find-an-element-that-contains-specific-text-in-python-selenium
Find an element that Contains Specific Text in Python Selenium - GeeksforGeeks
July 23, 2025 - XPath, which stands for XML Path Language, is a versatile method that can be used to navigate and find elements in both XML and HTML documents. In Selenium, we can use XPath to search for elements that contain specific text.
🌐
Tricentis
tricentis.com β€Ί home β€Ί learn β€Ί devops β€Ί selenium: finding elements by xpath with python
Selenium: Finding elements by XPath with Python - Tricentis
December 30, 2025 - In this post, see how to use XPath in Selenium with Python to locate elements from the page in an efficient and robust way.
🌐
BrowserStack
browserstack.com β€Ί home β€Ί guide β€Ί how to find element by text using xpath selenium: example
How to Find Element by Text using Xpath Selenium: Example | BrowserStack
December 31, 2024 - In such cases, QA engineers can locate the element using text visible on-screen corresponding to that particular web element. This is possible using the Find Element by Text method using the Xpath locator.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί locating-multiple-elements-in-selenium-python
Locating multiple elements in Selenium Python - GeeksforGeeks
July 12, 2025 - To check practical Implementation, visit - find_elements_by_name() driver method – Selenium Python Β· Note: command find_elements_by_name() is deprecated Β· With this strategy, all elements with pattern of xpath matching the location will be returned.
🌐
ScrapingBee
scrapingbee.com β€Ί webscraping-questions β€Ί selenium β€Ί how-to-find-elements-by-xpath-selenium
How to find elements by XPath in Selenium? | ScrapingBee
You can find elements by XPath selectors in Selenium by utilizing the find_element and find_elements methods and the By.XPATH argument. find_element returns the first occurence of the XPath selector being used, while find_elements returns all ...
🌐
Apify
blog.apify.com β€Ί selenium-find-element
Find elements in Selenium by XPath
May 26, 2025 - Using XPath with Selenium for simple and complex queries. This detailed guide covers basics and real-world examples.
🌐
Quora
quora.com β€Ί How-do-I-get-xpath-matching-count-in-selenium-python
How to get xpath matching count in selenium python - Quora
You can use the find_elements_by_xpath method to find all the elements matching the given XPath expression, and then get the count of the resulting list.
🌐
ScrapingAnt
scrapingant.com β€Ί blog β€Ί selenium-python-find-element
How to Find Elements With Selenium in Python | ScrapingAnt
July 29, 2024 - This code waits up to 10 seconds for an element with the ID "myElementId" to be present on the page (Selenium documentation). Use Multiple Locator Strategies: If one locator method fails, try alternative strategies. For instance, if finding by ID doesn't work, attempt to locate the element by XPath or CSS selector.
🌐
Reddit
reddit.com β€Ί r/selenium β€Ί using xpath to find element does not always work
r/selenium on Reddit: Using xpath to find element does not always work
May 12, 2021 -

I am using python 3.7 in jupyter notebook. It works just as it should until it doesn't. It says that it cannot find the element and then it never can find it again. I have restarted kernel and that did not solve it. I am just using xpaths from the homepage of pyhton.org.

edit:

To get the xpath I am coping it from the inspect element in chrome. When I compare the error xpath and the one from the webpage they are an exact match.

🌐
Fishtank
getfishtank.com β€Ί insights β€Ί findelement-and-findelements-by-xpath-in-selenium
FindElement And FindElements By XPath In Selenium Automation Testing | Fishtank
FindElements in Selenium command takes in By object as the parameter and returns a list of web elements. It returns an empty list if there are no elements found using the given locator strategy and locator value.