Not able to upload a file in Selenium Webdriver using python Scripting

0 votes

Not able to perform upload of video file using selenium webdriver. using the code I'm not getting any error but the process gets completed successfully. But, no file gets uploaded.

Can you help me fix it? The only thing I want to do is to attach a *.mp4 file. But as the cursor hovers, i'm unable to find the click or upload file.

Code Used


uploadElement = driver.find_element_by_xpath("//*[text()='UPLOAD ANSWER']")
driver.execute_script("arguments[0].removeAttribute('style')", uploadElement)

Below is the HTML CODE for the element.

<button class="ui button" role="button" style="background-color: rgb(31, 186, 238); color: white; border-radius: 0px; padding-left: 40px; padding-right: 40px; font-family: &quot;Open Sans&quot;; font-size: 17px; font-weight: 600; line-height: 20px; text-align: center; width: inherit; height: 50px; margin-top: 26px;">UPLOAD ANSWER</button>

Sep 10, 2019 in Selenium by Srinivas

1 answer to this question.

0 votes

Hey Srinivas, you can checkout this code snippet to get an idea:

from selenium import webdriver

from import By

from import WebDriverWait

from import expected_conditions as EC

driver = webdriver.Chrome()


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

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

answered Sep 10, 2019 by Abha
• 28,040 points

Related Questions In Selenium

0 votes
1 answer

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

Use this code, this will help you: from ...READ MORE

answered Apr 20, 2018 in Selenium by Vardy
• 2,360 points
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
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
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
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
0 votes
1 answer