Python Selenium Find Element by Name

19,639

find_element_by_name() method would fit here:

driver.find_element_by_name("quantity")
Share:
19,639
fightstarr20
Author by

fightstarr20

Boldly going.....

Updated on June 17, 2022

Comments

  • fightstarr20
    fightstarr20 almost 2 years

    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?

  • Padraic Cunningham
    Padraic Cunningham about 8 years
    The answer is almost in the title ;)
  • Leonardo Scotti
    Leonardo Scotti about 2 years
    now this is deprecated, use ind_element(by=By.NAME, value=name) instead