How to upload files using relative path at Selenium IDE? - selenium

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?

Related

The issue with downloading files with Selenium with Jenkins

Testers may have this issue for sure.
Assume that we have a testcase that should be automated. And it has a step to download a file from the webpage by clicking a link and it will be downloaded to our local machine’s download folder. As the next step it should be verified that the file is downloaded.
So in a local machine this can be handled easily by using the download paths and all. But the matter that I have is this exact same testcase is getting fail in Jenkins (cloud run). It returns a null value because the download directory cannot be found in Jenkins.
Do you guys know what kind of solution that can we take for this? I heard something using API request to download the file. Yes this file is also getting downloaded by a GET request with parameters. But I don’t know how to perform that.
Thanks for your time.
I tried the bellow options.
Changing the directory to Windows and Linux as per the documents
By using jenkins home directory
What I want to do?
to verify that the file is downloaded
Read the file and check with the db (This has existing methods)

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:

Use Run Configuration for IntelliJ File Watcher

I Just wanted to know really quickly why the IntelliJ File Watchers take command line programs rather than allowing me to use the Run Configurations?
I have my build chain nicely configured through the run configurations and I want to use the File Watchers to rerun certain parts of it when I modify certain source files.
Note that I could achieve this using Grunt which I already am using for this project, but I'd like to try using the file watchers.
Anyone know why this is so and how I can work around this?
Thanks

browse a file from my PC with selenuim

I want to write a selenium program on a site which I need as part of the process to browse a file from the operating system. How can I do that?
If you mean to use Selenium to open a html file on local, it's easy to do.
1. open the html file on browser
2. copy the url in browser address, it should be like:
file:///C:/workspace/js-projects/tey/protractor-cucumber-tey/reports/cucumber_report.html
3. put above url in browser.get()
Better way it's to caclcute the html file absolute path in your scritp dynamically (rather than hard code), then prefix with file://// on the path, possible need to replace '\' to '/' in path.
I don't know what you mean by "browse a file from the operating system."
If you mean choosing file to upload, you can.
see link below
https://www.programcreek.com/java-api-examples/index.php?api=org.openqa.selenium.remote.LocalFileDetector
If you want to browse a file in the local machine with the OpenFileDialog (not sure if this is what you are looking for), in my case, I created an autoIt script, building it as .exe and then call it from Java code (or any programming language you are using with Selenium).
I found an exmaple, it might works: https://github.com/ellysh/autoit-examples/blob/master/Helpfile/FileOpenDialog.au3

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.