#document 是什么意思? [英] What does #document mean?
问题描述
这是我拥有的 HTML 文件.我正在尝试使用 Selenium-Webdriver API 和 ChromeDriver 将 send_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.
document 是一个虚拟元素,没有任何意义.
如果您有多个框架/框架集,则必须切换框架.
document is a virtual element, which doesn't really mean anything.
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屋!