Here is HTML code:
<px-upload-zone class="dz-clickable" _ngcontent-c34="" _nghost-c35="">
<div class="upload-container" _ngcontent-c35="">
<!---->
<div class="dialog-wrapper dz-default dz-message" _ngcontent-c34="">
<span _ngcontent-c34="">Drag & Drop</span>
<span class="browse-label" _ngcontent-c34="">
<span _ngcontent-c34="">or</span>
<label class="link-label" _ngcontent-c34="">browse</label>
</span>
</div>
<div class="upload-summary" _ngcontent-c35="">
<div class="dropzone-previews" _ngcontent-c35="">
</div>
</px-upload-zone>
You can see in image detail:
How to handle Upload function if element is not "input" tagname?
CURRENT SOLUTION:
The element input[type="file"] is hidden behind screen and you can sendkeys to this element (work for upload one or multi-file). This is my code:
Page Object:
uploadDocument(fileName: string) {
fileName = '../resources/' + fileName;
const absolutePath = resolve(__dirname, fileName);
this.sendKeyToElement(this.uploadPage.INPUT_FILE_UPLOAD, absolutePath);
browser.sleep(2000);
}
Step Definition:
When(/^Upload document with file name$/, (table: TableDefinition) => {
for (const file of table.rows()) {
uploadPage.uploadDocument(file);
}
});
Feature:
And Upload document with file name
|Filename |
|Invoice 01.pdf |
|Invoice 02.pdf |
|Invoice 03.pdf |
|Invoice 04.pdf |
|Invoice 05.pdf |