18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

getting text line by line

zakka.fauzanzakka.fauzan Members
edited July 2013 in Sahi - Open Source
Let's say I have html like this.
Hello<br>My name is Zakka<br>How are you?<br>

How could I get the text line by line, I would like to have
arrayText = ["Hello", "My name is Zakka", "How are you?"];

Note that I couldn't know the text (it's generated, not something fix).

Answers

  • Hi Zakka,
    Is "Hello<br>My name is Zakka<br>How are you?<br>" a plain text in the html body?

    If yes, you can use the following code:
    var bodyText = document.body.innerHTML; 
    var arrayText= bodyText.split("<br>");
    

    Regards.
Sign In or Register to comment.