简体   繁体   中英

I am using Python and Selenium in order to automate site testing and cant get selenium to submit a form

I have used selenium to navigate the company site and fill out a specific form, but cannot get it to submit the form.

br = webdriver.Firefox()

<input type="submit" class="btn btn-primary btn-lg place-order" value="Place Order" 
       ng-disabled="userForm.$invalid || submitted == true" disabled="disabled">

//*[@id="errorTop"]/div[5]/div/div[3]/form/div[4]/div[2]/input

Above is the form info as well as the xpath of the form, I have tried the following to capture and click the submit button:

First try

br.find_element_by_css_selector('.btn.btn-primary.btn-lg.place-order').click()

Second try

br.find_element_by_xpath('//*[@id="errorTop"]/div[5]/div/div[3]/form/div[4]/div[2]/input').click()

Neither of which delivered the desired form submitting click.

Your code is definitely good but your submit button is disabled: disabled="disabled" , which is why you can't click on it.

Make sure it's not disabled before doing .click() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM