xpath - how to select this submit button?

13,939

Solution 1

I believe

//input[@value="Generate Schedules"]

will work

Solution 2

Another option: //input[@type='submit']

Solution 3

//input[@value='Generate Schedules']

will work (not sure it likes double quotes). When you want to match the exact text, you use the = sign. If you are trying to match partial text, you use a comma wrapped in contains:

//input[contains(@value,'Generate')]
Share:
13,939
Michael Durrant
Author by

Michael Durrant

rails ruby rspec rock

Updated on June 16, 2022

Comments

  • Michael Durrant
    Michael Durrant about 2 years

    How can I select this submit button?

    <li id="district_schedule_set_submit_action" class="action input_action ">
      <input class="sexybutton sexysimple sexyorange" type="submit" value="Generate Schedules" name="commit"></input>
    </li>
    

    What didn't work...

    //input[value()='Generate Schedules'
    //form[input()='Generate Schedules']
    //input(text(),'Generate Schedules'))
    //input[text(),'Generate Schedules')]