Reputation: 185
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:
Clicked on Select Button ()
Clicked on TextBox ()
Clicked on Span ()
Performed JavaScript click for all above mentioned elements
Tried driver.FindElement(By.Xpath("Xpath of Input Open file dialogue box")).SendKeys("FilePath");
Upvotes: 0
Views: 126
Reputation: 185
I followed below steps to resolve:
<input type="file" tabindex="0" class="ruFileInput" multiple="multiple" name="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" id="ctl00_ContentPlaceHolder1_fileMgr_RadAsyncMultiUploadfile0" size="23">
document.querySelectorAll('input[type = file]')[0];
element.className = ' ';
Upvotes: 0