enter image description hereI am trying to click on choose file button on my web application, but getting "Invalid argument " exception : Cannot click elements

1584522811772 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: mozillaAddons

1584522811772 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: telemetry

1584522811772 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: resource://pdf.js/

1584522811772 [email protected] WARN Loading extension '[email protected]': Reading manifest: Invalid extension permission: about:reader*

JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.

1584522814417 Marionette INFO Listening on port 25414

1584522814453 Marionette WARN TLS certificate errors will be ignored for this session

Mar 18, 2020 2:43:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession

INFO: Detected dialect: W3C

Exception in thread "main" org.openqa.selenium.InvalidArgumentException: Cannot click <input type=file> elements

Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'

System info: host: 'RSOMWANSHI2L1', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'

Driver info: org.openqa.selenium.firefox.FirefoxDriver

Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 73.0,

WebDriver Code : package RealTimeExercise_E2E_Practise;

import java.io.IOException;

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver;

public class FileUpload {

public static void main(String[] args) throws InterruptedException, IOException {
    //System.setProperty("webdriver.chrome.driver", "E:\\\\\\\\Practise\\\\\\\\Drivers\\\\\\\\chromedriver.exe");
    //WebDriver driver = new ChromeDriver();
    WebDriver driver = new FirefoxDriver();

    driver.findElement(By.xpath("//span[.='Use activation packet file']//parent::div//input[@type='radio']")).click();




File Path
  • pleease add the code and html
    – PDHide
    Commented Mar 27, 2020 at 8:14
  • which line are you getting the error at /
    – PDHide
    Commented Mar 27, 2020 at 9:38
  • @line : driver.findElement(By.xpath("//input[@type='file']")).click(); -Line 21 Commented Mar 27, 2020 at 9:51
  • please add the html, and you have to click the button element and not the input element. May be click action is not supported for that particular input element. Find element "Button" and click on it
    – PDHide
    Commented Mar 27, 2020 at 9:56
  • Actually its not button its input file only : Commented Mar 27, 2020 at 10:29

1 Answer 1


Use browser actions,

Actions builder = new Actions(driver);


The input element may not support the click action that's why you are getting the invalid argument error.

  • Hey Thanks, it worked :) well.... Commented Mar 29, 2020 at 13:36
  • @rashmisomwanshi could you upvote by clicking the up arrow icon near to my answerand accept the answer by clicking the tick sign near to my answer
    – PDHide
    Commented Mar 29, 2020 at 13:37
  • 1
    done...Thank You Commented Mar 30, 2020 at 4:11
  • @PDHide - I had the same problem (Not able to click on "choose file") and could find solution only through your answer. Thank you so much and keep sharing your knowledge. Commented Dec 28, 2021 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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