Getting Path is not canonical error while doing Functional Test Using Robot Framework - selenium

I am trying to write Robot Framework test for File Upload. I'm using the below Keyword to perform the function.
Choose File ${UPLOAD_FILE_HIDDEN_INPUT} ${UPLOAD_FILE_NAME}
where
${UPLOAD_FILE_HIDDEN_INPUT} xpath=//input[#type="file"]
and ${UPLOAD_FILE_NAME} is the Path location where I am trying to place the File that needs to be uploaded.
My testcase is in below directory
C:\Dev\Application\tests\functional\Robot\TestSuite\TestCase
I am placing the file which needs to be uploaded in below directory
C:\Dev\Application\tests\functional\Robot\Images\File1.jpg
I am declaring the variable ${UPLOAD_FILE_NAME} in the variable section of the test case. In order to get to the File Location, I need to go back one Folder
C:\Dev\Application\tests\functional\Robot\
and then proceed to images Folder
C:\Dev\Application\tests\functional\Robot\Images
In-order to perform this, I am using below value to the variable
${UPLOAD_FILE_NAME} ${CURDIR}\\..\\Images\\File1.jpg
But I am getting the below error
path is not canonical: C:\\Dev\\ClaimLogUI\\tests\\functional\\Robot\\TestSuite\\..\\Chrysanthemum.jpg\n (Session info: chrome=46.0.2490.86)\n (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64)'
I used similar kind of Folder notation as value to other files in some other scenario and it was working fine. I am not sure where I am going wrong in order to locate File1.jpg. I am using Chrome Browser to perform this test. Could someone help me?

You can use keyword Normalize Path from library OperatingSystem to make your path as a canonical
${NORMAL_PATH_UPLOAD_FILE_NAME} Normalize Path ${UPLOAD_FILE_NAME}
Then you can use this code without error
Choose File ${UPLOAD_FILE_HIDDEN_INPUT} ${NORMAL_PATH_UPLOAD_FILE_NAME}
(You can read this for futher information http://robotframework.org/robotframework/latest/libraries/OperatingSystem.html)

${CURDIR} is path to the directory where the test data file is located.
You should use ${EXECDIR} which is absolute path to the directory where test execution was started from.

Related

JMeter Distributed Testing java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)

setting up a distributed test with Jmeter i ended up in this problem.
First of all i'm aware setting the jmeter.property server.rmi.ssl.disable=true is a work around.
Still i'd like to see if it is possible to use this rmi_keystore.jks. The Jmeter documentation
https://jmeter.apache.org/usermanual/remote-test.html is clear enough about setting up the environment but doesn't mention at all how specify the path to the rmi_keystore.jks, or if this has to be the rmi_keystore.jks on the worker or the one in the controller.
I noticed if you do a test on your machine as worker and controller ( as this guy does https://www.youtube.com/watch?v=Ok8Cqc0wipk ) setting the absolute path to the rmi_keystore.jks works.
Ex. server.rmi.ssl.truststore.file=C:\path\to\the\rmi_keystore.jks and server.rmi.ssl.keystore.file=C:\path\to\the\rmi_keystore.jks and.
But this doesn't work when controller has a different path to the rmi_keystore.jks then the worker.
My question is : how can I set the right jmeter properties server.rmi.ssl.truststore.file and server.rmi.ssl.keystore.file to resolve the FileNotFoundException? Stating that default values don't work?
thank you everyone
You need to:
Generate the rmi_keystore.jks file on the master machine
Copy it to all the slaves
The default location (where JMeter looks for the file) is rmi_keystore.jks, to wit if you drop it to "bin" folder of your JMeter installation on master and slaves - JMeter will find it and start using.
The server.rmi.ssl.keystore.file property should be used if you want to customize the file name and/or location so if it is different you can either set slave-specific location via user.properties file or pass it via -J command-line argument.
If location is common for all the slaves and you want to override it in a single shot - provide it via -G command-line argument.
More information:
Configuring JMeter
Full list of command-line options
Apache JMeter Properties Customization Guide
You can use create-rmi-keystore.bat to generate the rmi_keystore.jks. You will find it under Bin folder.

JMeter non-GUI in Jenkins issue with Include Controller

I have two scripts in my test. A_script.jmx with the main test plan and the test fragment B_script.jmx with the module.
To include B-script into A_script.jmx I use the Include Controller with a path to the B_script.jmx
All works fine when I work in GUI locally but when I try to run it in Jenkins in non-GUI I receive an error:
Error in NonGUIDriver org.apache.jorphan.util.JMeterStopTestException:
ModuleController:Notification has no selected Controller (did you
rename some element in the path to target controller?), test was
shutdown as a consequence
As I suppose the Include Controller in the A_script.jmx cannot find my B_script.jmx file here.
Should I use some special path format in my Include Controller FileName? Both scripts are kept in one directory. I tried "B_script.jmx", "../B_script.jmx" etc
Any ideas where I'm wrong?

PhantomJS -headless browseer

I have to automate a test case in which a list in a particular dashboard is created. We decided to use PhantomJS headless browser. Since I am new to it, I tried creating test myself. Following are the steps I followed just to open the target website.
Created directory phantoms
cd phantoms and installed phantom module using command npm install phantom --save
Created file createlist.js:
createlist.js contents:
var phantom = require('phantom');
var page = require('webpage');
page.open('http://facebook.com', function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render('example.png');
}
phantom.exit();
});
When i execute command node create_list.js, I am getting the following error:
page.open('interact2.responsys.net/interact/jsp/jindex.jsp&#‌​39;, function(st atus) { ^ TypeError: page.open is not a function at Object.<anonymous> (C:\Users\shilshet\New folder\phantom\create_list.js:3 :6) at Module._compile (module.js:413:34)
If I try to execute command like
phantomjs C:/Users/shilshet/New folder/phantom/create_list.js
I am getting this error
bash: phantomjs: command not found
Note: I am using cygwin to execute commands
What I am going wrong? I installed phantomjs module also in the same folder as my node.js.
Could anyone let me know apart from using headless browser, how does one create a profile list in Oracle responsys via REST API call?
While the first answer here should work, it's not the best way to accomplish what you need. The cleaner way to solve your issue is to add the location of your phantomjs executable to your PATH variable defined in a file such as ~/.bash_history.
The file may not be defined, so you may need to create the file, and then add PATH="/path/to/phantomjs/executable"
If you prefer to edit your PATH var via a GUI: Edit PATH variable via Windows GUI
The reason you need to do this, is that your system natively iterates over paths defined in the 'PATH' variable in order to determine where executable files are. Since phantomjs is not included in the PATH variable (nonexistent in the environment), and you try to run 'phantomjs', your system simply does not know which executable to call (or rather it doesn't know it exists)
The reason this is the better approach is:
You don't need to explicitly write out the path of where phantomjs is located every time you want to run it (it's just cleaner looking too)
What happens if you you call phantomjs from multiple files, and the location of where phantomjs is stored changes? If you explicitly typed phantomjs' absolute path everywhere, then you need to change EVERY place you typed it! Nightmare! With this approach, you simply change it in one place; the file that defines your PATH variable
It's pretty conventional to add new file paths to your PATH env variable. You shouldn't clutter it, but it makes sense in this case to add it
For this: "Could anyone let me know apart from using headless browser, how does one create a profile list in Oracle responsys via REST API call?"... I would recommend asking a separate question. I personally don't know, but if you raise the new question, you may get support from someone who does.
Hope this helps! If you need any help whatsoever, let me know.
You mixed up two ways of running PhantomJS.
The more straightforward, more simple way is just launching PhantomJS from command line and giving it the path of a script as an argument. On Windows you would do it like this:
"C:/Users/shilshet/New folder/phantom/phantomjs.exe" "C:/Users/shilshet/New folder/phantom/create_list.js"
Note the quotes here, they're needed because there are spaces in filenames.

Is it possible to modify the chrome download directory during the test execution?

Here, it is possible to set the default download directory using preferences in chrome_capability during the driver initialization.
But, is it possible to modify the chrome preferences during the test?
In my scenario, I need to download a particular file in a specific directory, in order to access the file(since the filename is randomly generated) so that i can keep the 'specific directory' clean and get the file name(since there will be only one file)
I searched a bit and lots of people said that Driver options have to be declared before driver initialization so it is not possible to change download directory after you initialized driver object. You need to open new driver and set its options while your test in execution.

Executable cgi and image/javascript-files in lighty

I've add/commented out the following lines to my lighttpd.conf:
"mod_cgi"
and
cgi.assign = ( "" => "/var/www/myCgiScript" )
That works as expected... my executable mySite will be called on every request, but the problem is, that I can't open images. For instance, if I do the following:
http://localhost/myImage.png
This will call my executable cgi (mySite) - the same for js-files. Is Is there any chance to handle images as usual?
Thx in advance!
have a look at the documentation for cgi.assign:
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModCGI#Options
the first argument is a file extension, the second argument is the path to a CGI script to run when a file with that extension is requested. Right now, your config file is saying "for any, or no, extension, run '/var/www/myCgiScript'." You need to specify a set of file extensions for which you want the CGI script to run, and let lighty serve up all other files in the normal manner.