How can I save Selenium/Selenese tests as .json files? - selenium

How can I store a Selenium test in a .json file?
I would like to store Selenium tests as a logic-less .json file. Selenium IDE allows tests to be saved as .html file (http://docs.seleniumhq.org/docs/02_selenium_ide.jsp#selenium-commands-selenese), which is logic-less, but I really prefer to have data like this stored in a json file. Json makes it easier to work with test-runners like Nightwatch.js.
I do not want tests to be stored in .js, Java, Python, C#, Ruby formats.

It looks like Sauce Labs has developed a json format with its Selenium Builder: https://github.com/SeleniumBuilder/se-builder/wiki/JSON-Format

Related

How to refresh Cucumber Output file in IntelliJ while using multiple feature files?

I am using the BDD framework using Cucumber,
There are multiple feature files.
But am not able to get the output in the HTML file. (However, I can see the output in my console. )
Where am going wrong? How to keep this file(CucmberExtentReport.html) updated in IntelliJ IDEA?
Screenshot of the folders:
Am getting the HTML output only on running the whole configuration from here
But I want to run a single feature file and see the output which IntelliJ is not updating...
I am running single feature by clicking run like this:

How to upload files using relative path at Selenium IDE?

I'm trying to upload a file at Selenium IDE using relative path but it didn't work. I really tried some approachs like this answer
This way works:
But what I want to do is something like this:
I need it because I need to send these test files to run in another computer without have to edit the .side files. Anyone knows commands, scripts, or any other method that I could try at Selenium IDE?

How to download a file through a link with its extension type with scrapy

I am using scrapy to scrape a website and I can download the file from the page, however everything that is being download is a plain text file. How do I download it with it's extension type? I am downloading scripts and as such, having the proper extension type on my download is necessary.
For example, if I am downloading exploits from exploit-db, the link that I go to to download them would be for example: https://www.exploit-db.com/exploits/19832/
and the link i would extract from there to download from is https://www.exploit-db.com/download/19832 which will, if I click on it normally, download a ruby file. But through scrapy it gets saved as a text file. Is there a way to download it as a .rb through scrapy?
Just save it as filename.rb. All files are text/binary files. Extension is there just to tell your operating system what to use to understand that file.
(In some operating systems extension isn't even required since files have headers at the beginning of the file telling what they are)
You can do try this:
scrapy shell https://www.exploit-db.com/download/19832
Then in the shell or your spider just do:
with open('ruby_file.rb', 'wb') as ruby_file:
ruby_file.write(response.body)

intellij generate JDocs html files

I'm writing an website with intelliJ and my JS files have JSDocs annotations as supported by IntlliJ.
I there a way to produce JSDocs html files like with javadocs?

File upload path in a test

A geb test tests file upload in a grails application. According to the documentation the absolute path of the file has to be specified in the test. Is it possible to make the test a bit more portable between developers/machines by including a file in the grails source tree and then getting its absolute path from the geb test?
You may be interested in doing something like this
http://www.mkyong.com/java/how-to-get-the-filepath-of-a-file-in-java/
In the Get file path example he creates a temporal file and then gets its filePath. If you need a specific file then I recomend you to build / write on it after creating it, this way you have a User/enviroment free file to access from your app anytime.
I ran into a problem like this once, uploading a photo to a server with grails, and for test or repetitive actions I created it and added the base64 code on runtime.
Hope it helps. Good luck! :)
I just ended up using System.properties['base.dir'] to get real path to my application.
String cd = new File(".").getAbsolutePath().replace(".","");
String file = cd + "file.jpg"
println file
It's work for me, on windows an linux.
it's need for CI and local building test.