0

Have a input box and "Choose File" button.

Image of the form and Element description :

To identify the button, following code worked:

WebElement UploadButton=driver.findElement(By.xpath("//div[@class='uploader']/span[2]"));

However, when tried to click, it shows following error:

Element is not clickable at point (285,680) because another element input id="fileUpload" class="form-control" name="fileUpload" type="file"> obscures it

Why this button is not clickable and how can I perform Click action on it.

Mathews Sunny
  • 1,796
  • 7
  • 21
  • 31
Amit
  • 1
  • 1

1 Answers1

0

Generally, when it comes to uploading files, you need to avoid the fluff around it as it's eye candy for the user, but doesn't have the real functionality.

Also, uploading a file by clicking the button is extremely difficult because then you'll need to use another tool to deal with the file selection pop-up (It's not handled via Selenium).

So your best solution is to instead focus on the <input id="fileUpload" type="file"> which is how HTML handles file uploads. And leave the nice button pushing for manual acceptance testing.

MivaScott
  • 1,763
  • 1
  • 12
  • 30