有没有办法找到代码在浏览器中创建动态弹出窗口的位置?

有没有办法找到代码在浏览器中创建动态弹出窗口的位置?

问题描述:

当我打开一个不是由我开发的网站时,它会弹出DIV元素. 如何找到哪个代码创建该弹出窗口?

When I open a website that's not developed by me, it created a pop up of a DIV element. How can I find which code create that popup?

我试图设置断点,但是它只在第一次显示弹出窗口.

I tried to set the breakpoint, but it only show the popup in the first time.

请注意这里的钥匙

  1. 这不是我开发的网站

  1. It's a website that's not developed by me

弹出窗口是DiV

弹出窗口仅显示第一次.如果刷新页面,它就消失了.

The popup only show the first time. If I refresh the page, it's gone.

我不是要您为我调试站点,而是想学习自己调试的方法.

I'm not asking you to debug the site for me, I want to learn the ways to debug it by myself.

我要执行的操作是根据我设置的条件以编程方式设置断点.因此,如果有几种方法可以生成DIV,则可以将这些方法添加到条件中以全部捕获.由于本机调试器具有中断DOM操作的能力,因此我希望可以以编程方式进行相同的操作.也就是说,我可以通过在创建具有某些特征的DIV时指定条件来暂停执行.

What I'm after is programmatically set up a break point based on a condition that I set. So if there are several methods to generate the DIV, then I can add those methods to the condition to catch all. Since the native debugger has the ability to break on DOM manipulation, I expect I can do the same, but in the programming way. That is, I can pause the execution by specifying a condition when a DIV that has some traits created.

从理论上讲,我认为这是可行的,如果仅调试器可以将其函数公开为API,我想有一种方法可以在满足某些条件时设置断点. 就像下面 如果目标元素具有某些特征,请附加一个条件,然后中断.或者,如果代码块正在执行我指定的操作,请中断.

In theory I think it's doable, if only the debugger can expose their function as API, I imagine there is a way to set a breakpoint when some conditions are satisfied. It's like below Attach the process with a condition, if the target element has some traits, break. Or if the code block is doing something that I specified, break.

但是似乎现实是,Web浏览器上的调试工具是针对UI用户而非程序员的.我在这里可能是非常错误的.所以,如果可以的话,请纠正我.

But it seems the reality is debugging tools on web browsers are for UI users instead of programmers. I might be very wrong here. So Please correct me if you can.

有人遇到同样的挑战并且做了什么吗?

Did anyone face the same challenge and did something?

似乎已经完成,并且有API,但是我仍然不确定如何使用它来完成我想做的事情.

It seems this is done and there are APIs, but I'm still not sure how I can use it to do what I want.

https://developer.mozilla.org/zh-CN/docs/Tools/Debugger-API

我是否需要为此创建附件?

Do I need to create an add-on for this purpose?

也许GreaseMonkey足以胜任此任务?

Or probably GreaseMonkey is good enough for this quest?

似乎与Firefox调试API相关的文档已过时,暂存器已禁用.我无法通过本教程来学习调试器API

It seems the document related to Firefox debug API are outdated, the scratchpad is disabled. It's not possible for me to go through the tutorial to learn the debugger API

https://developer.mozilla.org/en-US/docs/Tools/Debugger-API/Tutorial-Breakpoint

通常,我使用Alert(message)创建一个弹出窗口,也许在检查器中搜索

Usually to create a popup I use Alert(message) maybe search in inspector for that