尝试使用以下代码从下面的html源获取框架:
idx = self.selenium.get_element_index("GEPNav")
idx = self.selenium.get_element_index("TOCFrames")
frame = self.selenium.select_frame("TOCFrames")
对get_element_index的2个调用用于测试并且它们可以工作,但是对select_frame()的调用返回None。不知道为什么......
<html>
<head>
<TITLE>NYSE Arca Bylaws and Rules</TITLE>
<link rel="stylesheet" href="/PCX/styles/GEP.css">
<script language="javascript" src="misc.js"></script>
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
</head>
<script language="javascript" src="RenderTOC.js"></script>
<script language="javascript">
var IntervalID = 0;
IntervalID = window.setInterval('setTimer()', 2000);
</script>
<frameset rows="188, *" border="0" >
<frame src="/PCXTools/ExchangeNav.asp?SelectedNode=chp_1_1&manual=/PCX/pcxe/pcxe-rules/" name="GEPNav" id="GEPNav" scrolling="no" FRAMEBORDER="0" noresize marginwidth="0" marginheight="0">
<frame src="/PCXTools/PlatformTOCFrame.asp?SelectedNode=chp_1_1&manual=/PCX/pcxe/pcxe-rules/#chp_1_1" Name="TOCFrames" id="TOCFrames" scrolling="no" FRAMEBORDER="0" noresize marginwidth="0" marginheight="0">
</frameset>
<noframes>
To be viewed properly, this page requires frames.
</noframes>