Suppose I have the following snippet on my web page:
<p> This is the text </p>
I want WebDriver to select "some" in this text, as if the user had selected it. How should I do it? I know how to get element <p>:
WebElement editable = getDriver().findElement(By.id("someId"));
editable = editable.findElement(By.tagName("p"));
System.out.println(p.getText());
Printout println "This is some text."
I tried to send the keys to the element and this was used to work (in selenium 2.0b), but now I am using selenium 2.6.0 and it stops working:
editable.sendKeys(Keys.chord(Keys.SHIFT, Keys.LEFT));
Does anyone have any ideas? I am using FirefoxDriver.
source
share