Question

Okay, so this is a weird situation. I have a JS file with a string:

 "@here This is a string";

What I'd like to do is define a function that finds and parses this file. It can search for a string with '@here in it, then allow me to parse it.

Is this possible? I'm not sure if there's a way to search the JS file you're in for strings (the string is declared before the function, if that helps).

UPDATE:

For the record, this string is generated by TestCafe, and to my knowledge I'm not sure if there's a way for me to modify it or assign it to a variable. I haven't been able to start, because I'm not sure if there's a way to parse the document I'm in with the script itself -- (kind-of inception-like!) and I wanted to see if there was anyway to do it.

If anyone is familiar with TestCafe-centric solution as well, that would be great!

Was it helpful?

Solution

On the surface, I'd recommend

  1. using the name of the file to
  2. re-request it from the server,
  3. store it into a string var
  4. search through that string
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top