Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I try to use selenium to mimic my action on a website to convert PDF files to EXCEL files. There are three steps to complete the conversion:

  1. Upload the PDF file.
  2. Input email address.
  3. Click the 'convert' button.

I wrote the code as below. However, every time I click the button the page just refreshes without actually converting the file.

from selenium  import webdriver

driver = webdriver.Chrome()
driver.get('https://pdftoexcelonline.com/en/')

# Upload file
el_upload = driver.find_element_by_name("file")
el_upload.send_keys(*<Path to the file>*)

# Input email
el_email = driver.find_element_by_name("email")
el_email.clear()
el_email.send_keys(*<email address>*)

# Convert button
el_button = driver.find_element_by_id("convert_now")
el_button.click()

driver.close()

This page works well when I completed the steps manually. What is reason that my code did not trigger the conversion?

share|improve this question

One possible reason is the not enough execution time. You can add some sleep after each action to verify. Treat it as workaround if work.

share|improve this answer
    
Thanks. But in my case, after inserting "time.sleep(5)" before and after each action, the problem still remains. I guess there are other problems here. – zwcikyf 47 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.