When I click on a link a popup opens where I can fill some fields. However, this popup contains an Iframe that contains the fields I want to use in my test. The problem is that I can't seem to switch to the iFrame in order to reach the fields.
I've tried the following first but this results in a (org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"/html/body/iframe"}):
driver.switchTo().frame(driver.findElement(By.xpath("/html/body/iframe")));
I then tried the following, this seems to pass the iFrame but resulted in (org.openqa.selenium.TimeoutException: Timed out after 15 seconds waiting for element to be clickable: By.id: //div[@class='actionbutton-content unselectable']) and (NoSuchElementException: Unable to locate element: {"method":"id","selector":"//div[@class='actionbutton-content unselectable']"}):
driver.switchTo().frame(0);
wait.until(ExpectedConditions.elementToBeClickable(By.id("//div[@class='actionbutton-content unselectable']")));
Here is the first section of the page source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
<script src="scripts/JQuery/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
script here....
</script>
</head>
<body MS_POSITIONING="GridLayout" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<input type="hidden" id="newxObjectID"> <input type="hidden" id="newxObjectName"/>
<iframe height="100%" width="100%" frameborder="0" scrolling="no" src="fxeditobject.aspx?function=showobjectfields&key=0x3928x0x60937x&viewid=&callerwindow=true&fieldDefId=0&defid=3928" >
#document
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html webdriver="true">
<head></head>
<body id="PageBody" onload="" etc. etc. etc. >
**Fields I'm looking for are somewhere in this area**
</iframe>
</body>