javascript - Chrome developer tool does Not capture a form submit in network tab, Why? - Stack Overflow

a simple html page,<body><form method="POST" action="abc"><input ...

a simple html page,

<body>
    <form method="POST" action="abc">
        <input ... />
    </form>
</body>

submit the form with javascript

document.getElementsByTagName('form')[0].submit()

The request was indeed submitted (the server return a file as download), but I could not find any activity in network tab.

any idea? thanks in advance.

Update: Firefox is working well on capturing this.

a simple html page,

<body>
    <form method="POST" action="abc">
        <input ... />
    </form>
</body>

submit the form with javascript

document.getElementsByTagName('form')[0].submit()

The request was indeed submitted (the server return a file as download), but I could not find any activity in network tab.

any idea? thanks in advance.

Update: Firefox is working well on capturing this.

Share Improve this question edited Nov 28, 2017 at 20:35 Rm558 asked Nov 21, 2017 at 22:29 Rm558Rm558 5,0124 gold badges42 silver badges47 bronze badges 7
  • 1 Is this html page is your popup or a normal page? are you inspecting the network for your popup page {right click on popup page>inspect>network} or for a normal page{right click on browser page>inspect>network}? – Abozanona Commented Nov 21, 2017 at 22:33
  • Because you create a new window with new page loaded by submit process and that clears all network history from prior window (page) – charlietfl Commented Nov 21, 2017 at 22:33
  • @charlietfl As seen in the photo, he has checked the preserve log option, which will not clear the console after it refreshes, right? – Abozanona Commented Nov 21, 2017 at 22:35
  • @Yazan W Yusuf, it's a normal page, I simplified a bit. – Rm558 Commented Nov 21, 2017 at 22:37
  • Could you please give more details. This script is in a content page, right? – Abozanona Commented Nov 22, 2017 at 0:10
 |  Show 2 more ments

2 Answers 2

Reset to default 1

From https://stackoverflow./a/55197547/3774338

If it triggers an event to download a file, Chrome will create a new tab and this tab will be closed immediately so that you cannot capture this request in Dev Tools.

Solution: check 'Offline' checkbox at the network tab, which will fail to send the request, so the tab will not be closed.

The solution to go offline before starting a download didn't work for me, but I've found a better one.

Enable the Auto-open DevTools for popups option in DevTools preferences. It makes Chrome open the DevTools window for a new window/tab of the download URL just before the Save dialog appears.

DevTools Preferences

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745094460a4610890.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信