How to upload a resume to a website using selenium in python?

0 votes

Below is the html which is having a “upload a resume” button on a website. I logged in to this website but now wanted to upload a resume using python selenium.

<a href="/resumes/new">upload a resume</a>

Below is the code I tried for clicking the upload a resume button. But it is throwing an error

NoSuchElementException: Message: Unable to locate element: //a[@href="/resumes/new"]

Attach_resume = browser.find_element_by_xpath('//a[@href="/resumes/new"]')

Is there anything that I am missing? I want to click that button and I want to upload a file to it. Please help me out.

Apr 20, 2018 in Selenium by Martin
• 4,220 points
1,073 views

1 answer to this question.

0 votes

Use this code, this will help you:

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()

driver.get('https://www.careerbuilder.com')

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//a[@href="/resumes/new"]'))).click()

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'resumeOnComp'))).click()

driver.find_element_by_id('ucResumeUpload_newFileUpload_inputResumeUpload').send_keys('/path/to/file')
answered Apr 20, 2018 by Vardy
• 2,250 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
750 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
995 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
709 views
+9 votes
14 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,250 points
64,842 views
0 votes
1 answer

Select an item from a dropdown list using Selenium WebDriver

Use this then it will work - new ...READ MORE

answered Apr 9, 2018 in Selenium by Vardy
• 2,250 points
2,359 views