Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium找不到javascript元素_Javascript_Jquery_Selenium_Selenium Webdriver - Fatal编程技术网

Selenium找不到javascript元素

Selenium找不到javascript元素,javascript,jquery,selenium,selenium-webdriver,Javascript,Jquery,Selenium,Selenium Webdriver,我想使用以下代码登录页面: driver.findElement(By.xpath(".//*[@id='uiPostGetPage']")).sendKeys("admin"); 但是selenium找不到这个元素,因为我检查了源代码,没有一个元素名为uiPostGetPage 网站的源代码如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset

我想使用以下代码登录页面:

driver.findElement(By.xpath(".//*[@id='uiPostGetPage']")).sendKeys("admin");
但是selenium找不到这个元素,因为我检查了源代码,没有一个元素名为
uiPostGetPage

网站的源代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Airties</title>
<script type="text/javascript" src="/lang.js"></script>
<script type="text/javascript" src="/js/Definitions.js"></script>
<script type="text/javascript">
<!--
document.title = "AirTies " + __DEF_BuildProfile;
if (top.frames.length!=0)

top.location=self.document.location;
// -->

</script>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Cache-control" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<script language="JavaScript" type="text/JavaScript">
<!--
document.title = "AirTies " + __DEF_BuildProfile;
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->

</script>
</head>

<frameset rows="115,*" frameborder="NO" border="0" framespacing="0">
  <frame src="top_login.htm" name="topFrame" scrolling="NO" noresize >
  <frame src="loginmain.html" name="mainFrame">
</frameset>
<noframes>

<body>
</body></noframes>
<head>
<META HTTP-EQUIV="Cache-control" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="-1">
</head>
</html>

航空
如果您查看,则没有任何元素包含登录代码

如何发送此隐藏的
uiPostGetPage
元素?

我怀疑所需的元素在iframe中。切换到it:

driver.switchTo().frame("mainFrame");