Saturday, 15 September 2012

java - Selenium: Unable to enter text into iframe -


I am using the following Java function to enter text in iframe:

  Public Boolean EnterTextIntoFrame () {string text = this.data; // String Boolean results = true; Try {if (keyType.equals ("xpath")} {Thread.sleep (2000); WebElement ifr = driver.findElement (By.xpath (OR.getProperty (keyValue))); . Driver.switchTo () defaultContent (); . Driver.switchTo () frame (IFR); // Author: Ruchir Sharma; 17/3/2015 (Driver Presentation FirefoxDriver) {WebElement ckeContent = driver.findElement (By.tagName ("body")); CkeContent.clear (); CkeContent.sendKeys (text); } // Author: Ruchir Sharma; 17/3/2015 if (driver's example is Criorior) {WebElement ckeContent = driver.findElement (By.tagName ("body")); CkeContent.clear (); CkeContent.sendKeys (text); } And (javascript exchanger) driver) .executeScript ("document.getElementsByTagName ('body') [0] .winnerHTML = argument [0];", text, ""); . Driver.switchTo () defaultContent (); }} Hold (exception e) {result = false; } Return results; }  

Instead of entering the string 'text' in the IFrame, my code enters the string "undefined" when I run the code above. help please.


No comments:

Post a Comment