#document 是什么意思? [英] What does #document mean?

查看:76
本文介绍了#document 是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我拥有的 HTML 文件.我正在尝试使用 Selenium-Webdriver APIChromeDriversend_keys 发送到 input 中的 >.但是我无法访问 #document 中的任何内容.我不明白为什么.有人可以告诉我这个 #document 是什么意思,以及如何使用 Selenium 访问其中的任何元素.

This is the HTML file I have. I am trying to use Selenium-Webdriver API along with ChromeDriver to send_keys to an input filed inside the <body>. But I can't access anything which is inside of #document. I cannot figure out why. Can someone please tell me what this #document means and how can I access any of the elements inside this using Selenium.

<html>
<head>…<head>
<frameset >
    <frame>...</frame>
            <frame name="mainFrame" src>
                #document
                    <html>
                      <head>…</head>
                      <body>…</body>
                    </html>
        </frame>
    </frameset>
</frameset>

这是一个路由器网页,实际网页很大,所以我没有贴在这里.

This is a router webpage, the actual webpage is HUGE, so I haven't pasted it here.

推荐答案

总结一下我学到的和实施的.

Just to summarize on what I learnt and implemented.

  1. document 是一个虚拟元素,没有任何意义.

  2. 如果您有多个框架/框架集,则必须切换框架.

  1. document is a virtual element, which doesn't really mean anything.

  2. If you have mulitple frames/framesets, you will have to switch frames.

一个.所以首先进入 默认内容.driver.switch_to_default_content()

B.然后进入您要使用的框架.frame = driver.find_element_by_name('mainFrame')

b. then get to the frame that you want to work with. frame = driver.find_element_by_name('mainFrame')

然后使用该框架中的元素.

Then play with the elements in that frame.

这篇关于#document 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆