I am using the Selenium Web driver. I have a text area where some text is written. Now How can I add some text / html in it or paste data in a specific place?
The following code adds it to a text area / text field
driver.findElement(By.xpath("textBox/textArea")).sendKeys("abc");
i.e. if the text area / text field contains 123. The result above will be 123abc . But I want abc123 or 12abc3
PS: I am testing the functionality of "Email Reply". So, as a user, when you reply to mail, you do not copy the text, and then clear all the text, and then copy all the text after writing new text, as shown below:
WebElement element = driver.findElement(By.xpath("textBox/textarea")); String previousText = element.getAttribute("value"); element.clear(); element.sendKeys("abc" + previousText);
Please, help...
source share