This is my HTML:
<button ng-if="!isIE()" id="UploadedFileBtn" data-ng-click="SelectFile()" title="Browse" text="Browse" style="padding-bottom :5px" class="ng-scope">
<mosaic-icon name="upload" width="20" height="20" class=""><svg class="icon" width="20" height="20"><use xlink:href="#mosaic_icon_upload"></use></svg></mosaic-icon>
</button>
One button is used to open file explorer. This is my java code:
public void depositSingleDocument(String path, String doctype) throws InterruptedException
{
DriverOperations.getWhenElementVisible(upload);
upload.sendKeys(path);
i am not able to open the file explorer and hence can not pass the file path.
Firstly, make sure the filepath has not caused an issue. Example path below:
E:\\Patients_Data\\Patient_One.xml
instead of E://Patients_Data/Patient_One.xml
Next,
If you have one more input tag along with button tag(i.e a textbox in the UI next to the button), then try calling sendkeys method for the input tag to set the file path.
If the above two points doesn't solve your problem, Then you have to go with below approach: Click on a button which opens the file upload window, which is not a web component and not supported by Selenium. Use any third party tool like Autoit, Sikuli which supports native window popup
public void depositSingleDocument(String path, String doctype) throws InterruptedException
{
DriverOperations.getWhenElementVisible(upload);
upload.click();