google chrome devtools - Dev Tools Recorder stucks when replay change on input type file - Stack Overflow

admin2025-05-02  8

I'm using Edge/Chrome DevTools Recorder to simulate a series of steps a user might perform on a webpage. The goal is to profile the page's performance and assess the impact of code changes.

Everything works smoothly during the recording phase, including selecting a file for upload. However, when replaying the recorded steps, the process always times out at the "change input file" step, regardless of how high I set the timeout (I’ve tried up to 30 seconds). I've already tried to make the input element visible, add a custom step type (don't know exactly what is it for).

Has anyone encountered and resolved this issue or found a workaround?

Here is the exported JSON:

{
"title": "File Process",
"timeout": 30000,
"steps": [
    {
        "type": "setViewport",
        "width": 1132,
        "height": 956,
        "deviceScaleFactor": 1,
        "isMobile": false,
        "hasTouch": false,
        "isLandscape": false
    },
    {
        "type": "navigate",
        "url": "http://localhost:4200/home",
        "assertedEvents": [
            {
                "type": "navigation",
                "url": "http://localhost:4200/home",
                "title": "Page Title"
            }
        ]
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "aria/Select a Use Case"
            ],
            [
                "[data-testid='UseCaseDropDown'] span"
            ],
            [
                "xpath///*[@id=\"pn_id_5\"]/span"
            ],
            [
                "pierce/[data-testid='UseCaseDropDown'] span"
            ],
            [
                "text/Select a Use"
            ]
        ],
        "offsetY": 11.078125,
        "offsetX": 348
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "aria/Document Preparation (Chain of Density)",
                "aria/[role=\"generic\"]"
            ],
            [
                "p-dropdownitem:nth-of-type(1) span"
            ],
            [
                "xpath///*[@id=\"pn_id_5_0\"]/span"
            ],
            [
                "pierce/p-dropdownitem:nth-of-type(1) span"
            ],
            [
                "text/Document Preparation (Chain"
            ]
        ],
        "offsetY": 18.078125,
        "offsetX": 283
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "label span.p-button-label"
            ],
            [
                "xpath///*[@id=\"pn_id_11_content\"]/div/div/label/p-button/button/span[2]"
            ],
            [
                "pierce/label span.p-button-label"
            ],
            [
                "text/Choose files"
            ]
        ],
        "offsetY": 13.28125,
        "offsetX": 259
    },
    {
        "type": "change",
        "target": "main",
        "selectors": [
            "[data-testid='FileInput']",
            "xpath///*[@data-testid=\"FileInput\"]",
            "pierce/[data-testid='FileInput']"
        ],
        "value": "\"C:\\path\\to\\real\\existing\\file.pdf\""
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "div.new-process-form__start-bt-wrapper span.p-button-label"
            ],
            [
                "xpath///*[@data-testid=\"StartUploadButton\"]/button/span[2]"
            ],
            [
                "pierce/div.new-process-form__start-bt-wrapper span.p-button-label"
            ],
            [
                "text/Start upload"
            ]
        ],
        "offsetY": 15.296875,
        "offsetX": 22.1875
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "aria/Process 1"
            ],
            [
                "#pn_id_13_header_action"
            ],
            [
                "xpath///*[@id=\"pn_id_13_header_action\"]"
            ],
            [
                "pierce/#pn_id_13_header_action"
            ]
        ],
        "offsetY": 40.671875,
        "offsetX": 91.8125
    },
    {
        "type": "click",
        "target": "main",
        "selectors": [
            [
                "div.process-result__summary p-button:nth-of-type(2) span"
            ],
            [
                "xpath///*[@id=\"pn_id_13_content\"]/app-process/div/app-process-result/div/div[2]/app-feedback/div/p-button[2]/button/span"
            ],
            [
                "pierce/div.process-result__summary p-button:nth-of-type(2) span"
            ]
        ],
        "offsetY": 10.828125,
        "offsetX": 11.859375
    }
]

}

转载请注明原文地址:http://www.anycun.com/QandA/1746117749a91914.html