1

I want to do login a page with this code:

driver.findElement(By.xpath(".//*[@id='uiPostGetPage']")).sendKeys("admin");

But selenium can not find this element because i checked source code there isn't an element which called uiPostGetPage

There is the site's source code:

<!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>

If you looked there isn't any element which contains login codes.

What can i do to sendKeys this hidden uiPostGetPage element?

1 Answer 1

1

I suspect the desired element is inside an iframe. Switch to it:

driver.switchTo().frame("mainFrame");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.