#文档是什么意思? [英] What does #document mean?
问题描述
这是我拥有的HTML文件。我正在尝试使用Selenium-Webdriver API和ChromeDriver将 send_keys
添加到<$ c $内部提交的 input
C><身体GT; 。但我无法访问 #document
中的任何内容。我无法弄清楚为什么。有人可以告诉我这个#文档的含义是什么,以及如何使用Selenium访问这个文档中的任何元素。
< HTML>
< head> ...< head>
< frameset>
< frame> ...< / frame>
< frameset>
< frame name =mainFramesrc>
#document
< html>
< head> ...< / head>
< body> ...< / body>
< / html>
< / frame>
< / frameset>
< / frameset>
这是一个路由器网页,实际的网页非常庞大,所以我没有粘贴它。
只是总结了我学到的东西和实施的内容。
-
document是一个虚拟元素,它并不代表什么意思。
-
如果您有多个框架/框架集,您必须切换框架。
a。因此首先请访问默认内容。
driver.switch_to_default_content()
b。然后转到您想要使用的框架。
frame = driver.find_element_by_name('mainFrame')
然后使用该框架中的元素。
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>
<frameset>
<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 is a virtual element, which doesn't really mean anything.
If you have mulitple frames/framesets, you will have to switch frames.
a. so first get to the default content.
driver.switch_to_default_content()
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.
这篇关于#文档是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!