I'm doing automation using WDIO and want to upload a file but the input element is disabled. The style element of the input selector has :
When I change it to this, element is visible
I wish to change this through my javascript code, this is what I've tried so far:
const inputFilePath = "#kyc-image-file-input";
await this.driver.execute(
(elem) => elem.style.display = 'block',
await this.driver.$(inputFilePath),
);
await WaitUtil.pause(this.driver, 5000);
await (await this.digioPage.getPanAndAadhaarUploadFileInputEle()).setValue(remoteFilePath);
await WaitUtil.pause(this.driver, 5000);
Javascript throws the below error when I do this:
Please let me know the correct way of changing the display property.
Thanks in advance :)
CodePudding user response:
You need to change style:
(elem) => elem.style.display = 'block'
CodePudding user response:
Try this, selecting the element you want to change:
const inputFilePath = "#kyc-image-file-input";
await this.driver.execute(
(elem) =>
document.querySelector(elem).style.display = 'block',
await this.driver.$(inputFilePath),
);