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,340 points
1,395 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,360 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to measure page load time of a website using Selenium-Python?

Hello Damodar, following test script allows you ...READ MORE

answered Jul 22, 2019 in Selenium by Anvi
• 14,110 points
4,137 views
0 votes
1 answer
0 votes
2 answers

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,520 points
3,813 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,794 views
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,890 points
2,762 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,129 views
+10 votes
15 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,360 points
122,214 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,360 points
4,933 views