Note- use \n to move the control to next line.
ex-
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TextBox {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://selenium-makeiteasy.blogspot.in/2014/05/if-any-textbox-is-disabled-then-how-to.html");
WebElement textBox = driver.findElement(By.xpath("//iframe[@id='comment-editor']"));
driver.switchTo().frame(textBox);
WebElement comment = driver.findElement(By.xpath("//textarea[@id='commentBodyField']"));
comment.sendKeys("good \n nice");
}
}
ex-
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TextBox {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://selenium-makeiteasy.blogspot.in/2014/05/if-any-textbox-is-disabled-then-how-to.html");
WebElement textBox = driver.findElement(By.xpath("//iframe[@id='comment-editor']"));
driver.switchTo().frame(textBox);
WebElement comment = driver.findElement(By.xpath("//textarea[@id='commentBodyField']"));
comment.sendKeys("good \n nice");
}
}
No comments:
Post a Comment