Am running my selenium java tests in Docker's chrome container installed in my windows system.
Tests to upload will pass if i run tests in windows - chrome, but failing with error path is not absolute: D:\xyz.csv if i run same tests in docker.
Am pushing my tests on chrome node in docker.
Normal selenium tests work in docker, but upload doesn't.
Please suggest on how to copy this file inside container to give that path for upload tests..
Thanks
That is because Chrome would look for that path in the system where it. But the container is a linux based system and the file paths are not like this.
So you need to share volume while launching the chrome container
docker run -v localfolder:containerfolder
and in your test you need to use the contaienrfolder path and not the localfolder path
I got the solution of this problem long time back.
Use below command to copy the files from windows/Linux system to Chrome container running in docker's say 'tmp' folder , this path can be later referenced in selenium tests running in Docker.
"docker cp D:\file.csv docker_chrome_1:/tmp/"
This above command can be run once Docker's Chrome container is up and running in Windows/Linux machine.
Related
I am trying to launch browser for automation testing(selenium) using jenkins on ubuntu OS. Test are running properly but browser is not launching seems like it is running headlessly.
I am able to fix this using this solution -
Added Xvfb plugin and added DISPLAY variable.
Running jenkins.war
from console using java -jar jenkins.war
As I know in Windows OS by checking "Allow service to interact with desktop" while jenkins installation we can fix this. So Is there any way we can do this on ubuntu by updating some configuration so we don't have run jenkins.war from console everytime.
There are two ways to facilitate the launch of browser on ubuntu OS.
1.First way - Configure your Jenkins nodes and add the ubuntu machine. Add the sshing details(username-password OR RSA key) of the target machine. This configuration is recommended if you are in cloud.
2.Second way(not recommended on cloud environments) -You have to run a Selenium standalone-Server (a standalone node), and register your remote WebDriver to it.
WebDriver driver = new RemoteWebDriver(new URL("http://ipOfUbuntuMachine:port/wd/hub"), capability);
I have the following Dockerfile which will build a Selenium server
FROM selenium/standalone-firefox:3.4.0-chromium
FROM selenium/standalone-chrome
USER root
ENV NODE_ENV test
RUN mkdir -p /usr/local/cdt-tests/csv-data
COPY ./csv-data /usr/local/cdt-tests/csv-data
USER seluser
obviously the two FROM statements is incorrect => How can I create a Selenium server container that has both a Chrome driver and Firefox driver for Selenium. As far as I can tell, the selenium/standalone-firefox:3.4.0-chromium image only works for Firefox.
There is no inheritance type setup for Dockerfiles like you are suggesting.
To implement a combined build you would need find the common FROM ancestor of the standalone-firefox and standalone-chrome, which is selenium/node-base and create your own Docker file to reapply all the build steps that selenium/standalone-chrome applies. Then keep it in sync whenever Selenium update their builds.
Dockerfile Hierarchy:
selenium/node-base
/ \
selenium/node-chrome selenium/node-firefox
| |
selenium/standalone-chrome selenium/standalone-firefox
The problem is these builds have been designed to be seperate, so there is significant overlap in the variables and settings that the images use that you would also need to unpick in your custom build to control and run both chrome and firefox at the same time. You will probably end up having to do everything from scratch.
Selenium Grid
Running individual Selenium grid node's behind a grid hub is the standard way to do multi browser testing from a single endpoint. You can run Firefox, Chrome or Phantom JS nodes in Docker or connect standard nodes from anywhere else.
Poor mans grid
You can always run a container for Chrome and Firefox on seperate ports and point the same test suite at a different port if setting up a Grid is a lot of work for the simple case of running some tests against each browser.
You cannot merge two docker files likes that. You can use one as a base for your docker file, then copy the important bits from the other into your one.
However you shouldn't really need to. There are images out there with multiple browsers and drivers included. Or better, you could set up a grid with the hub image and some driver images.
You might even consider a library such as Serenity or a product such as Katalon, both of which do it all for you. There is even a Katalon docker image designed for use in CI: it's command-line + headless only, but that's all you need for most of your CI-driven regression testing.
I created a docker container. I can ssh into the docker container. How can I view files in my docker container with a GUI (specifically the WebStorm IDE)?
I'm running a MAC on OSX Yosemite 10.10.5.
The usual pattern is to mount your source code into the container as a volume. Your IDE can work with the files on your host machine and the processes running in the container can see the files. docs
There might be a way to set up remote file access with WebStorm, but I'd recommend trying the other approach first.
docker run daemon -v /mycodedir:/mydockerdir {libraryname}/{imagename} if you mount your work directory and map it to the directory running files in the container you will be able to edit and see them in Web Storm.
I know I'll get crap for this but it's worth it if someone can help.
I can't find a guide, tutorial, or instructions anywhere for installing web driver on a windows machine. I've got a site running on a homestead vagrant box and need a way of running acceptance tests locally. I had tests setup using PhpBrowser but those don't simulate JavaScript. If anyone knows of a guide to do this or a better way to run acceptance tests it would help immensely. I've got Ajax calls so PhpBrowser and resources like it won't work.
Thanks!
Just download the selenium webserver the jar file and run it in a command shell with java -jar selenium-server-standalone-2.43.1.jar. The selenium server will now listen on the default port 4444. If you run your test it should work as expected. Keep in mind that selenium webserver opens firefox and uses it for testing. It's pretty useful for watching the test cases.
If you want a headless test (no visible browser) you need to download phantomjs. Unpack it and run the phantomjs.exe with --webdriver=4444 as an argument (so phantomjs.exe --webdriver=4444).
Download and Run the selenium-server-standalone-2.43.1.jar as stated in the comment. I had to add firefox_binary: C:\Program Files (x86)\Mozilla Firefox\firefox.exe under capabilities: in my acceptance.suite.yml file. I also added it to the path variable but I'm not sure if that made a difference. Had to add the firefox_binary to make it work.
I browsed a lot on this topic. There are different variations of this question or no answer to fix my issue. Any help is appreciated.
I have installed firefox on my VM as root in /usr/bin/firefox.
I downloaded the maven project to run selenium tests, and run it
manually on my VM using mvn clean install command. This opens the
browser and also successfully runs the test.
Now I run Jenkins as myself ( JAVA_HOME is /usr/java/latest and started the service as
nohup java -jar jenkins.war --httpPort=-1 --httpsPort=8082; version
is 1.522).
Create a new freestyle s/w project; Configure the job
to download the maven project and invoke maven target 'clean
install';
When I run the job, I can see the steps in the console
output but the browser is not opening. It also locks up my AD account.
Why is this happening? What is the fix?
nohup runs Jenkins in the background (http://en.wikipedia.org/wiki/Nohup), in which case according to this post Jenkins will start the browser in the background as well.
Try starting jenkins without nohup so that it runs in the foreground (java -jar jenkins.war --httpPort=-1 --httpsPort=8082).
Or you can start Jenkins as a daemon (this Jenkins Wiki page contains an example of init script). When Jenkins is started as daemon, the browser started by its job is visible.