Vaibhav Dhasmana
Vaibhav Dhasmana

Reputation: 185

Telerik Open File Dialogue not getting clicked using Selenium web driver click function

Link to Image of UI where selenium click is required

HTML & CSS Code of above shown UI:

<span class="ruFileWrap ruStyled">
    <input type="text" class="ruFakeInput radPreventDecorate" id="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfakeInput0" size="22">
    <label for="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfakeInput0" style="display:none">label</label>
    <input type="button" tabindex="-1" value="Select" class="ruButton ruBrowse">
    <input type="file" tabindex="0" class="ruFileInput" multiple="multiple" 
           name="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" id="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" size="23">
    <label for="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" style="display:none">label</label>
    </span>

Observation:

File Upload functionality is achieved by using Telerik Control

Problem:

Need to Upload file but whenever Selenium WebDriver click is performed on ‘Select’ button the following Error is coming

OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element.

There were different errors for different elements which were clicked. One of them was 'Element is not clickable'

Failed attempts which were tried to open File Dialogue:

  1. Clicked on Select Button ()

  2. Clicked on TextBox ()

  3. Clicked on Span ()

  4. Performed JavaScript click for all above mentioned elements

  5. Tried driver.FindElement(By.Xpath("Xpath of Input Open file dialogue box")).SendKeys("FilePath");

Upvotes: 0

Views: 126

Answers (1)

Vaibhav Dhasmana
Vaibhav Dhasmana

Reputation: 185

I followed below steps to resolve:

  1. Found out a open File Dialogue was hidden ( because of class ruFileInput )

<input type="file" tabindex="0" class="ruFileInput" multiple="multiple" name="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" id="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" size="23"> 

  1. To Unhide it I removed the ruFileInput class using JavaScript

document.querySelectorAll('input[type = file]')[0];
element.className = ' ';

  1. Then performed normal selenium web-driver click on it.

Upvotes: 0

Related Questions