Python Selenium Find Element by Name

fightstarr20 picture fightstarr20 · Feb 25, 2016 · Viewed 14.1k times · Source

I am using Python Selenium and am trying to select in input box that does not have an ID

<div class="form-group"><input type="email" class="form-control" name="quantity" placeholder="Type a quantity"></div>

inputElement = driver.find_element_by_id("quantity")

What is the best way to select this element, by name?

Answer

alecxe picture alecxe · Feb 25, 2016

find_element_by_name() method would fit here:

driver.find_element_by_name("quantity")