-2

how to enter formatted text from word document in textarea using selenium webdriver with java?

I want to automate hrm app where i want to automate copy and paste job discriptions in textarea with formatted text.

So please suggest me how to do it using selenium webdriver using java

enter image description here

Jasmine.Olivra
  • 1,751
  • 9
  • 24
  • 37

1 Answers1

2

See my answer here which describes how to parse text from a Word document. Note that it will extract all of the "plain text" from the Word document. You can then use the following (as an example) to set text of an element with Selenium:

// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");

I realize you asked for formatted text, but I would be surprised if somebody has a reliable solution to do that. There might be an external tool out there, though. You can also execute Javascript with Selenium's JavascriptExecutor functionality, so you could use that to get the Word doc as HTML then add it to your page.

Community
  • 1
  • 1
KyleM
  • 4,445
  • 9
  • 46
  • 78