Rayrun
← Back to Discord Forum

XMl file upload not working,

anirudh.ruhelaposted in #help-playwright
Open in Discord
anirudh.ruhela

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?"

2 replies
anirudh.ruhela

@debbieobrien Can I get any help

anirudh.ruhela

@mxschmitt Can you help on the scenari

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.