单击 iFrame 内的元素

发布于 2024-12-13 17:11:13 字数 771 浏览 3 评论 0原文

我的内置浏览器下载了一个页面。
在此页面的“body”下,有一个“iframe”标签。
在此 iframe 内部,还有另一个代码(div 标签、表格等)。
但我不知道如何访问它们。

webBrowser1.Document.GetElementById("myiFrame").innerHTML // gives out empty result as if there is nothing there.
webBrowser1.Document.GetElementById("myiFrame").FirstChild.innerHTML // gives an error as if there is no first child.
webBrowser1.Document.GetElementById("mylink") // error as if it doesn't exist
webBrowser1.Document.GetElementsByTagName("a")[2] // error as if it doesn't eist

我已经没有选择了。

我需要单击该框架深处的一个东西:

body -> div -> div -> div -> form -> div -> div -> div -> div -> div -> div -> div -> div -> table -> tbody -> tr -> td -> a

My built-in browser downloaded a page.
On this page under "body", there is an "iframe" tag.
Inside of this iframe, there is another code (div tags, table etc).
But I don't know how to access them.

webBrowser1.Document.GetElementById("myiFrame").innerHTML // gives out empty result as if there is nothing there.
webBrowser1.Document.GetElementById("myiFrame").FirstChild.innerHTML // gives an error as if there is no first child.
webBrowser1.Document.GetElementById("mylink") // error as if it doesn't exist
webBrowser1.Document.GetElementsByTagName("a")[2] // error as if it doesn't eist

I ran out of options.

I need to click a thing that is deep inside of this frame:

body -> div -> div -> div -> form -> div -> div -> div -> div -> div -> div -> div -> div -> table -> tbody -> tr -> td -> a

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

記柔刀 2024-12-20 17:11:13


Document.InvokeScript([无论您要单击什么]

工作吗?

您确定已全部下载吗?Webbrowser.ReadyState 会为每一帧触发 Ready。

Does
Document.InvokeScript([whatever it is you want to click]

Work?

Are you sure that its all downloaded? Webbrowser.ReadyState triggers Ready for every frame.

自演自醉 2024-12-20 17:11:13

您应该加载 iframe 中出现的页面,而不是加载父页面并浏览它。您可以获取 iframe 的 src 属性并导航到该页面。这样你就可以轻松访问你需要访问的节点。

Instead of loading the parent page and going through it, you should load the page which appears within iframe. You can get src attribute of iframe and navigate to the page. This way you can easily access nodes you need to access.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文