I am uploading a xml,My application reads that xml and create a user. iT is working fine when i am uplaoding the xml manually but, I am getting error when i am uploading the file from automation(playwright ). I have tried both the ways input file as well as file chooser.
Reason of failing: manually we are selecting file from the "OpenFileDialog" windows. and from automation we could only set the path to the attribute directly.
public static void uploadWithFileChooser(String element, String filePath) {
LOGGER.info("Smart Doc path "+filePath);
FileChooser fileChooser = FrameworkConfig.LocalPage.waitForFileChooser(() -> {
//page.getByLabel("Upload file").click();
CommonUtility.click(element, 30000);
});
//fileChooser.setFiles(Paths.get(filePath));
fileChooser.element().setInputFiles(Paths.get(filePath));
}
@??? @dev
This thread is trying to answer question "Why is the XML file upload not working when using automation with Playwright, and how can it be fixed?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].