SeleniumHQ/selenium-ide

FileRead command

Opened this issue ยท 11 comments

๐Ÿš€ Feature Proposal

New command to import the text of a file in a textarea (in a wiki, for example).

Motivation

No command for the moment and interface of selenium IDE doesn't support a long text with special characters.

Example

I imagine:

Command1 : FileRead
target: return ${localpath} + "/myfile.txt"
value: varText

Command2 : TYPE
target: id=idtextarea1
value: ${varText}

cw010 commented

Selenium ide can't read the file system, so I guess it should be unsupported

@tcwaily is right, as a browser extension we don't have direct access to the file system. We'd have to build a file upload mechanism. The simplest thing right now is to do it through a plugin. There's one out there for doing something like this with CSVs (link). Doing the same thing but for flat text files is an interesting addition to that project. Ultimately, once we move to a native app this will be easier to accomplish.

@tourdedave I agree, in the meantime this could be a plugin, once we move to a native app this can definitely be standard library.

Thanks. I hope it will be native also for Fedora/Centos ;)
Bye

Almost a year... I have may be an idea.

A quick solution can be to create a simple script 'importFileSe' with 3 parameters:

  1. origin file with all tests (Tests.side)
  2. root folder of files to import in the final Json
  3. output filename (for example FinalTests.side)

Everywhere, where there is the command 'file read'. The script 'importFileSe' will import the text in the Json.

Without waiting a native app, you can insert the command 'file read' with the same code than 'store'. If the native app is developped, you can replace the code.

What do you think ?

I don't understand, you mean bundle the file inside the json?

I want to insert simply the texts of files directly in the Json.

More simple again... Everywhere in the JSON, a program will replace a pattern, for example {{<myData.txt>}}, by the text in the file.
It works without changing SE IDE...

Sure then insert them into the JSON, that's a fine workaround.

SE IDE supports partially reading file, i.e File upload via <input type = "file"...
Reference: #1097

For info, while waiting for the readFile command, I wrote a little script in this project

./importFile.sh input.side -o output.side