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.

Sahi _writeFile New Line

qazwsx988qazwsx988 Members
edited November -1 in Sahi - Open Source
When writing to a file, the text is being added to the end of the already existing text. How do I add new lines to a text file using _writeFile?

Comments

  • Hi
    set the overrride flag
    API _writeFile(text, filePath[, overwrite])
    Notes Writes the text into file at filePath.
    if overwrite is true, the file contents are overwritten.
    Default is false which will append text at the end.

    regards
    Wormi
  • Hi,

    I didn't mean to overwrite the existing text, I wanted the ability to add new text to a new line in the existing file.

    So I figured out that adding a "\r\n" to the end of the string that I'm writing to the file will work.
  • Well yes, if you set overwrite to false and start the text to append with "\n" it should start in a new line.
Sign In or Register to comment.