I am using webdriver.io for my end-to-end testing. I want to check if proper files are being downloaded.
My problem is with the file download location. I want to use separate downloads directory for each test browser instance (hence for each test file), because I want to have fresh directory under test.
I tried to set (in wdio.conf.js):
chromeOptions.prefs['download.default_directory'] = path.join(__dirname, "/downloads/", browserName, process.pid.toString());
using PID of the process, but it does not work. But the process.pid is the same for all tests. So how can I accomplished that? How to set different download directory (for Chrome browser) for each test browser instance and then grab that directory path in the test itself?
You can use timestamp as it will be different for all tests.
chromeOptions.prefs['download.default_directory'] =
path.join(__dirname, "/downloads/", browserName, new Date().getTime());
Related
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.
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', 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.
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.
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.
I have a test using Webdriver and C# which downloads a file from a website.
When running this test on my local machine it works fine but when I try to run it on Selenium grid it Looks for the file I'm downloading on the hub and not on the node.
Is the anyway of accessing the node file structure to monitor when the file is downloaded.
Sorry if this is unclear.
Thanks
Aidan
It seems, there is no such possibility.. I have also tried to find such functionality, but failed.
But, one way to check it still exists - "upload downloaded". Of course it is workaround and not always you have such function as upload.
Anyway, you may:
download test data
delete test data from page
upload test data on page again
check it was really appeared
It is quite dirty way, but on other hand it allows you to test not only download function, but also upload function.