Webdriver - Type in FCKeditor
FCK editor is one of the complex object to handle through any automation tool.
After going through the page HTML, I have noticed two i frames. I have used following code to send message to FCK editor.
driver.switchTo().frame(driver.findElement(By.id("ctl00_cpheRFx_Section_desc___Frame")));
Print("Switched");
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@src='javascript:void(0)']")));
Print("Switched1");
driver.findElement(By.xpath("//body[@contentEditable='true']"));
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys("Selenium");
//Inside iFrane, come back to main page
try
{
Set<String> availableWindows = driver.getWindowHandles();
Print("Handle Size:" +availableWindows.size());
//Retreive all the window handles into variables
String WindowIDparent= null, WindowIDModal = null;
int counter = 1;
for (String windowId : availableWindows) {
if (counter == 1){
Print(Integer.toString(counter)+" " + windowId);
WindowIDparent = windowId;
}
counter++;
}
//Navigate to Parent window
driver.switchTo().window(WindowIDparent);
Print("In the Parent");
Wait(2000);
}
catch (WebDriverException e)
{
e.printStackTrace();
Print("Issue in the Switch");
xKillIEs(); //driver.quit() not working with modal dialog
}
----
FCK editor is one of the complex object to handle through any automation tool.
After going through the page HTML, I have noticed two i frames. I have used following code to send message to FCK editor.
driver.switchTo().frame(driver.findElement(By.id("ctl00_cpheRFx_Section_desc___Frame")));
Print("Switched");
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@src='javascript:void(0)']")));
Print("Switched1");
driver.findElement(By.xpath("//body[@contentEditable='true']"));
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys("Selenium");
//Inside iFrane, come back to main page
try
{
Set<String> availableWindows = driver.getWindowHandles();
Print("Handle Size:" +availableWindows.size());
//Retreive all the window handles into variables
String WindowIDparent= null, WindowIDModal = null;
int counter = 1;
for (String windowId : availableWindows) {
if (counter == 1){
Print(Integer.toString(counter)+" " + windowId);
WindowIDparent = windowId;
}
counter++;
}
//Navigate to Parent window
driver.switchTo().window(WindowIDparent);
Print("In the Parent");
Wait(2000);
}
catch (WebDriverException e)
{
e.printStackTrace();
Print("Issue in the Switch");
xKillIEs(); //driver.quit() not working with modal dialog
}
----
No comments:
Post a Comment