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,320 points
2,880 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.edureka.co')

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,150 points
11,827 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,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

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

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 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,910 points
7,221 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 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
+10 votes
17 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
197,973 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
7,764 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP