Giter Site home page Giter Site logo

aerokube / images Goto Github PK

View Code? Open in Web Editor NEW
167.0 17.0 125.0 3.61 MB

Browser images for Selenoid and Moon 1.x

Home Page: https://aerokube.com/images/latest/

License: Apache License 2.0

Shell 30.12% Go 51.83% Dockerfile 18.05%
selenium selenoid docker containers dockerfile images moon

images's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

images's Issues

Mapping Android to Selenoid Containers

Hi,

As per our discussion in the support channel, I am raising this enhancement request so that it is easy to track referring this issue where we are redirected towards the Android dockerfile #10

WebRTC support broken in Firefox 58.0

It seems that the support for WebRTC (i.e. the installation of pulseaudio and so on) implemented in #24 is broken in Firefox 58.0. To confirm it, we can use the following scenario. Let's suppose we have a Firefox 57.0 up an running like this:

docker run --rm --cap-add=SYS_ADMIN -p 4444:4444 selenoid/vnc:firefox_57.0

Now we can run a WebDriver test against this browser as follows:

import static org.openqa.selenium.OutputType.BASE64;
import static org.openqa.selenium.firefox.FirefoxDriver.PROFILE;
import static org.openqa.selenium.remote.DesiredCapabilities.firefox;

import java.net.MalformedURLException;
import java.net.URL;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class WebRtcRemoteFirefoxTest {

    private WebDriver driver;

    @Before
    public void setup() throws MalformedURLException {
        DesiredCapabilities capabilities = firefox();
        FirefoxProfile profile = new FirefoxProfile();
        profile.setPreference("media.navigator.permission.disabled", true);
        profile.setPreference("media.navigator.streams.fake", true);
        capabilities.setCapability(PROFILE, profile);
        URL url = new URL("http://localhost:4444/wd/hub");
        driver = new RemoteWebDriver(url, capabilities);
    }

    @After
    public void teardown() {
        if (driver != null) {
            driver.quit();
        }
    }

    @Test
    public void test() {
        driver.get(
                "https://webrtc.github.io/samples/src/content/devices/input-output/");
        String screenshotBase64 = ((TakesScreenshot) driver)
                .getScreenshotAs(BASE64);
        System.err.println("data:image/png;base64," + screenshotBase64);
    }

}

Everything goes fine. We can check it by pasting the screenshot in base64 written by the test (System.err.println) in a browser navigation bar. The result is the following:

image

Now, if we change the browser to 58 using the following command:

docker run --rm --cap-add=SYS_ADMIN -p 4444:4444 selenoid/vnc:firefox_58.0

... and run the same test again, the screenshot is different. We have no media anymore in the video tag:

image

It seems in the new Firefox 58 image the pulseaudio package is no longer available. Could you please confirm?

Cant send Appium args

Hi. I try to add --relax-security arg to start appium in android. I send env APPIUM_ARGS with no effect. I think the error is in android/entrypoint.sh. At line APPIUM_ARGS=""

Building the aerokube/selenoid and selenoid/vnc images

Hi,

I'm a newbie to Docker and I would like to apologize in advance if the following queries are too simple:

I work in a corporate environment where traffic out to the internet is highly restricted and thus we are not able to pull any images from the docker repository. As such, I will need to manually build the images myself.

Currently, we are using the following images:

  • aerokube/selenoid:1.3.4
  • selenoid/vnc:chrome_60.0
  • selenoid/vnc:firefox_46.0

My goal would be to update them to the latest versions.

May I know if these are the appropriate github urls for them?

I have also some questions related to the urls:

  • How do I know if I should build either the 'local' or 'apt' folder of the chrome and firefox URLs?
  • Do I need to build the 'Dockerfile.driver.tmpl' files for both browsers?
  • For the 'base' folder, do I need to build both the Dockerfile in the 'base4' and the 'java' folder?

Thanks a lot!

Unexpected error. unknown command: wd/hub/session

I am trying to run selenoid based auto-case by sidecar container, but failed with errors: "Unexpected error. unknown command: wd/hub/session". Not sure any other configurations need to be considered here? Please specify them. Thanks a lot.

Below are the detail configurations:

Jenkinsfile:
_node {
checkout scm

docker.image('selenoid/chrome').withRun("--name selenoid -p 4444:4444") { c ->
		echo 'hello world'
		sh 'curl http://localhost:4444/wd/hub'
		sh 'curl http://localhost:4444/status'
	docker.image('microsoft/dotnet').inside(" -u root:root --link ${c.id}:selenoid") {
		sh 'curl http://selenoid:4444/wd/hub'
		sh 'curl http://selenoid:4444/status'
		sh 'pwd && ls && dotnet build && cd SM_Regression && dotnet test'
    }
}

}_

Initialize remote web driver in dotnet code as below:
var url = "http://selenoid:4444/wd/hub";
driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

On Host:
_:/$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f64270768658 microsoft/dotnet "cat" 9 seconds ago Up 8 seconds cranky_chandrasekhar
465ff22c8bdb selenoid/chrome "/usr/bin/microinit …" 16 seconds ago Up 15 seconds 0.0.0.0:4444->4444/tcp selenoid

:/$ docker logs 465ff
Waiting xvfb...
Starting ChromeDriver 2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf) on port 4444
All remote connections are allowed. Use a whitelist instead!
Failed to read: session.ignoreBorder
Setting default value
Failed to read: session.forcePseudoTransparency
Setting default value
Failed to read: session.colorsPerChannel
...
Setting default value
Failed to read: session.screen0.toolbar.onhead
Setting default value
Failed to read: session.screen0.toolbar.placement
Setting default value
Failed to read: session.screen0.toolbar.height
Setting default value

:/$ curl http://localhost:4444/status
{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-130-generic"}}}

:/$ curl http://localhost:4444/wd/hub
unknown command: wd/hub_

Jenkins logs:
_[Pipeline] {
[Pipeline] sh

[Selenoid-job] Running shell script

  • curl http://selenoid:4444/wd/hub
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
    100 23 100 23 0 0 4156 0 --:--:-- --:--:-- --:--:-- 4600
    unknown command: wd/hub[Pipeline] sh

[Selenoid-job] Running shell script

  • curl http://selenoid:4444/status
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
    100 133 100 133 0 0 24309 0 --:--:-- --:--:-- --:--:-- 129k
    {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Linux","version":"4.4.0-130-generic"}}}[Pipeline] sh
    [Selenoid-job] Running shell script_

How to use Android images

I'm trying to understand how to use the Android images. If I run the following command:

docker run --rm --name android -p 4444:4444 selenoid/android:8.1

... the output I get is as follows:

* daemon not running; starting now at tcp:5037
emulator: Android virtual device file at: /root/.android/avd/android8.1-1.ini
emulator: virtual device content at /root/.android/avd/android8.1-1.avd
emulator: virtual device config file: /root/.android/avd/android8.1-1.avd/config.ini
emulator: using core hw config path: /root/.android/avd/android8.1-1.avd/hardware-qemu.ini
emulator: using snapshot lock path: /root/.android/avd/android8.1-1.avd/snapshot.lock
emulator: Found AVD target API level: 27
emulator: Read property file at /opt/android-sdk-linux/system-images/android-27/google_apis/x86//build.prop
emulator: No boot.prop property file found.
emulator: autoconfig: -kernel /opt/android-sdk-linux/system-images/android-27/google_apis/x86//kernel-ranchu-64
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /opt/android-sdk-linux/system-images/android-27/google_apis/x86//ramdisk.img
emulator: Using initial system image: /opt/android-sdk-linux/system-images/android-27/google_apis/x86//system.img
emulator: Using initial vendor image: /opt/android-sdk-linux/system-images/android-27/google_apis/x86//vendor.img
emulator: autoconfig: -data /root/.android/avd/android8.1-1.avd/userdata-qemu.img
emulator: autoconfig: -initdata (null)
emulator: autoconfig: -cache /root/.android/avd/android8.1-1.avd/cache.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 0MB is below hardware specified minimum of 192MB,setting it to that value
emulator: System image is read only
emulator: Found 2 DNS servers: 8.8.8.8 8.8.4.4
emulator: there is no '1080x1920' skin in '/opt/android-sdk-linux/platforms/android-27/skins/'
emulator: found magic skin width=1080 height=1920 bpp=16

emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded
* daemon started successfully
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found
error: no devices/emulators found

It seems clear the device emulator image is missing. How can I solve that? Thank you.

Please add Firefox ESR images

Would be nice to have images for major Firefox versions from ESR channel in this repo in addition to regular release versions, since ESR is what many organizations actually test their products against. If not feasible, will wait for resolution of #18.

Beta and dev images for Chrome and Firefox

It would be great if any time you release a new image tag for Chrome y Firefox, you also release another image with the next beta and dev versions for these browsers. I mean selenoid/chrome:beta, selenoid/chrome:dev, selenoid/chrome:beta, selenoid/chrome:dev, etc. What do you think?

chromedriver --url-base=/wd/hub

Is it any option to pass arg url-base to chromedriver?
I'm trying to run standalone selenoid/chrome instead of selenium/standalone-chrome for CI docker

Test  tests/acceptance/ClientCanLoginCest.php:clientCanLogin
                                                                                                                                                             
  [Facebook\WebDriver\Exception\WebDriverException] JSON decoding of remote response failed.
Error code: 4
The response: 'unknown command: wd/hub/session'

org.openqa.selenium.WebDriverException: json: cannot unmarshal string into Go struct field Caps.sessionTimeout of type uint32

Observed with Centos-7, with Selenium - 3.11 & Selenoid -1.8.2

FirefoxOptions firefoxOption = new FirefoxOptions(); firefoxOption.setAcceptInsecureCerts(true); firefoxOption.setHeadless(false); firefoxOption.addArguments("-foreground"); firefoxOption.setCapability("version", version); firefoxOption.setCapability("enableVNC", true); firefoxOption.setCapability("enableVideo", true); firefoxOption.setCapability("videoName",videoName+".mp4"); firefoxOption.setCapability("logName",videoName+".log"); firefoxOption.setCapability("name",videoName); firefoxOption.setCapability("platform", Platform.LINUX); firefoxOption.setCapability("resolve_ip", false); firefoxOption.setCapability("sessionTimeout", "60s");

When launched with above configuration, Exception thrown - org.openqa.selenium.WebDriverException: json: cannot unmarshal string into Go struct field Caps.sessionTimeout of type uint32.

Uploading file functionality doesn't work for firefox container

I'm using:

  • latest (3.13.1) C# selenium client library
  • latest (1.7.1) selenoid server
  • 61.0 and 58.0 firefox docker images
 _fileInput.WaitForPresent().SendKeys(fullFilePath);


OpenQA.Selenium.WebDriverException : zip: not a valid zip file
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebElement.UploadFile(String localFile)
   at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)

This code works well either for chrome container or local run of firefox

Add the ability to set custom DPI for android skin

Add the ability to set custom DPI for android skin

Now we have set of default skins https://aerokube.com/selenoid/latest/#_android_skin_skin, and also can set custom screen size, but it will always have DPI 160

But actual mobile devices uses big DPI on big resolutions

To achieve that, we need to create a custom skin for the emulator on the go, with needed dpi

Example of that I found on StackOverflow -https://stackoverflow.com/questions/4791943/emulating-density-of-320-dpi-on-android-emulator

Video recording with sound

Hi,

First, thank you for this great piece of software, works out of the box like a charm.

I have a particular use case where a videoconference should be recorded and I need help figuring out if it's even posible to achieve.

As the title suggests, I need to record the selenoid browser session with sound.

Doing this on a server with no sound card might be tricky.

From my research the following steps should be taken:

  1. enable on the host OS snd-dummy (https://superuser.com/questions/344760/how-to-create-a-dummy-sound-card-device-in-linux-server)

  2. on the browser machine:
    - install alsa-utils and define /etc/asound.conf
    - install pulseaudio and add user running chrome to audio group (I don't know if this step is really required if my system does not have a sound card)

  3. ffmpeg should be compiled with alsa support and should pick up the sound from the dummy sound card added

From all this I managed to do 1 by creating a custom docker image raduburla/chrome which works well, i think, chrome finds the sound devices and 2, the OS finds the virtual sound card.

With 3 I am unable to modify the image that records video, I might be missing some docker knowledge here.

The videos recorded by selenoid are still without sound.

I am missing something or what I am trying to achieve is not even possible?

Any help appreciated, thank you.

Support Arbitrary User IDs for OpenShift

VNC can not start and create log due to permissions issue

--- x11vnc loop: waiting for: 102
error opening logfile: /home/selenium/x11vnc.log
open: Permission denied
 --- x11vnc loop: sleeping 500 ms ---
[1527593837.027][DEBUG]: DevTools request: http://localhost:12696/json/version
[1527593837.027][DEBUG]: DevTools request failed
$ ls -la /home/selenium
total 0
drwxr-xr-x 4 selenium nogroup 39 Apr 18 06:55 .
drwxr-xr-x 3 root     root    22 Apr 18 06:55 ..
drwxr-xr-x 2 selenium nogroup 18 Apr 18 06:55 .fluxbox
drwxr-xr-x 2 selenium nogroup  6 Apr 18 06:55 Downloads
$

Regarding to docs https://docs.openshift.com/container-platform/3.3/creating_images/guidelines.html
Fixed by changing group to 0

RUN chgrp -R 0 /home/selenium && \
    chmod -R g=u /home/selenium

Download *.deb files from web-server

This allows to do something like:

RUN wget http://localhost/google-chrome-stable-xxx.deb && dpkg -i google-chrome-stable-xxx.deb && rm google-chrome-stable-xxx.deb

This economizes ~50 Mb per image. Images should be served by e.g. Nginx running in Docker container.

Windows behavior for VNC browsers

I'm using the VNC images for Chrome, Firefox, and Opera. Concretely, I am interacting with browser session through noVNC. Ideally, these browsers should be identical to the real browsers, but in the practice they are not. I'm listing here some differences:

  • The buttons for maximize, minimize and close are not available in the dockerized browser.
  • The button to open the preferences (for example, the icon with three points at right-top in Chrome) is not working.
  • The browser window in Chrome and Opera cannot be moved using drag and drop.

For me this very inconvenient since I need to mimic the behavior of the dockerized browser through noVNC.

Is it possible to solve these issues at least in the VNC flavor of the Selenoid images? Thank you in advance.

Unexpected error. 404 page not found

We setup Selenoid container on host based on below 4 steps which listed in "Get Started" documentation:
1.Create config/browsers.json configuration file with content:
2.Pull browser Docker image:
$ docker pull selenoid/chrome
3. Option 2: start Selenoid container
docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v pwd/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release

  1. On host execute:
    $ docker ps -a
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    e877bc8a06c1 aerokube/selenoid:latest-release "/usr/bin/selenoid -…" About an hour ago Up About an hour 0.0.0.0:4444->4444/tcp selenoid

$ curl http://localhost:4444/
404 page not found
$ curl http://localhost:4444/status
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"latest":{}}}}

and then setup another container to build dotnet environment and store souce code by jenkinsfile -> dockerfile, attach jenkinsfile and dockerfile here.

In my test project, initial chrome webdriver as:
var url = "http://172.17.0.1:4444/";
driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

Notes: 172.17.0.1 is hte docker0 ip address. Service of http://172.17.0.1:4444/ is here, but seems no page provided.
_$ ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:e3:2e:1f:72
inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::42:e3ff:fe2e:1f72/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1464419 errors:0 dropped:0 overruns:0 frame:0
TX packets:3600226 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:850225695 (850.2 MB) TX bytes:3525812879 (3.5 GB)

eth0 Link encap:Ethernet HWaddr 00:0d:3a:81:35:66
inet addr:10.0.0.4 Bcast:10.0.15.255 Mask:255.255.240.0
inet6 addr: fe80::20d:3aff:fe81:3566/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13566273 errors:0 dropped:175 overruns:0 frame:0
TX packets:13908363 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9689929939 (9.6 GB) TX bytes:3306969112 (3.3 GB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:6015 errors:0 dropped:0 overruns:0 frame:0
TX packets:6015 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:375651 (375.6 KB) TX bytes:375651 (375.6 KB)

veth8bf64bb Link encap:Ethernet HWaddr e6:b0:ae:41:f2:6d
inet6 addr: fe80::e4b0:aeff:fe41:f26d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:490 (490.0 B) TX bytes:1491 (1.4 KB)

vetha8cddd5 Link encap:Ethernet HWaddr 96:b5:9b:3e:8c:7d
inet6 addr: fe80::94b5:9bff:fe3e:8c7d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:578861 errors:0 dropped:0 overruns:0 frame:0
TX packets:955049 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:437292861 (437.2 MB) TX bytes:353539990 (353.5 MB)_

When executing auto-case, we get error message: "Unexpected error. 404 page not found". Here we can see the 4444 service is up, and no page provide on http://localhost:4444, please specify how to configure my source code to get the remote web driver? Or are there any other required configurations missed? Thanks.

Problem in first session request on EC2 instance

Running in AWS environment.
We've built an AMI with:
ubuntu 14.04
Docker version 17.09.1-ce, build 19e2cf6
aerokube/selenoid:latest (as to date 8/01/2017)
docker-compose version 1.18.0, build 8dd22a9

docker-compose.txt

Curl to create session:
curl -v 'http://localhost:4444/wd/hub/session' -X POST -d '{"desiredCapabilities": {"maxSessions": 100000, "browserName": "chrome", "acceptInsecureCerts": true, "loggingPrefs": {"browser": "ALL"}, "marionette": true, "maxInstances": 1, "logLevel": "DEBUG", "enableVNC": true}}'

When we start an instance from the AMI and call the Curl to create session for the first time we get:
404 page not found

After the first time, the creation always works.

We saw in the logs it receives a timeout on session creation:
2018/01/08 15:39:42 [0] [SERVICE_STARTED] [selenoid/firefox:57.0] [7b1edfeaaa7cd7cbf8964fd9eb7348982c62cc5b95af3670f0d014d965365094] [2.42670143s] 2018/01/08 15:39:42 [0] [PROXY_TO] [selenoid/firefox:57.0] [7b1edfeaaa7cd7cbf8964fd9eb7348982c62cc5b95af3670f0d014d965365094] [http://172.17.0.4:4444/wd/hub] 2018/01/08 15:39:42 [0] [SESSION_ATTEMPTED] [unknown] [http://172.17.0.4:4444/wd/hub] [1] 2018/01/08 15:40:13 [0] [SESSION_ATTEMPT_TIMED_OUT] [unknown] 2018/01/08 15:40:13 [0] [SESSION_ATTEMPTED] [unknown] [http://172.17.0.4:4444/wd/hub] [2] 2018/01/08 15:40:13 [0] [SESSION_FAILED] [unknown] [Bad response from http://172.17.0.4:4444/wd/hub - 404 Not Found]

What could be the problem?

A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/wd/hub/session

Hello All,

We're building a auto pipeline to run browser based auto-case on Selenoid container, error prompts on when initializing remote web driver. Currently, we haven't find a good way to fix it, maybe this is a bug, please double check, and then share your suggestions here. Thanks.
"
A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/wd/hub/session.
The status of the exception was UnknownError, and the message was: An error occurred while sending the request. Couldn't connect to server
"

Below are our configurations:

  1. In our dotnetcore test code, we initialize the Chrome webdriver as below:
    var url = "http://localhost:4444/wd/hub";
    driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

  2. Jenkinsfile:
    pipeline {
    agent {
    dockerfile {
    args '-u root:root'
    }
    }

       stages{
    
     		stage('BUILD') {
     			steps{
     			  script {
     						sh 'pwd && ls && dotnet build && cd SM_Regression && dotnet test'
     			  }                  
     			}
     		}
     	}
    

    }

  3. Dockerfile:
    FROM selenoid/chrome
    USER root

    COPY /SM_Regression/TestData/ /tmp/jenkins/data/docker/workspace/Selenoid-job/SM_Regression/bin/Debug/netcoreapp2.0/TestData/

    RUN apt-get update -y
    && apt-get install curl -y
    && apt-get install apt-transport-https -y
    && apt-get install ssh -y

    RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    RUN mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

    RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main\n" >> /etc/apt/sources.list

    RUN apt-get update -y && apt-get install dotnet-sdk-2.1.3 -y
    RUN export PATH=$PATH:$HOME/dotnet
    RUN dotnet --version

    COPY . /sourcecode
    WORKDIR /sourcecode/SM_Regression

    USER selenium

  4. For the Jenkins console output, we can see the Selenod/chrome image installed successfully, and new container generated as below:
    Selenoid/chrome image:
    selenoid/chrome latest ac98981f6dbe 3 weeks ago 945MB

    Selenoid container:
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    f6c19ff66e19 0b759698dd03feebda2547ad062afe39d65aaeae "cat" 19 seconds ago Up 17 seconds 4444/tcp elated_payne

    Notes: we also have double check the selenoid container logs, nothing stored in it.

  5. But we intialize the remote webdriver, we get below errors in jenkins console output logs:
    A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:4444/wd/hub/session.
    The status of the exception was UnknownError, and the message was: An error occurred while sending the request. Couldn't connect to server

  6. We also have tried to setup Selenoid container on host manually (based on the 4 steps which listed in the Selenoid "Get Started" documentations), and then access its service to run our case. Totally, it's working for us. But this is just a workaround, and not we want to do, what we need is auto setup Selenod environment, instead of manual steps.
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    e877bc8a06c1 aerokube/selenoid:latest-release "/usr/bin/selenoid -…" 5 days ago Up 5 days 0.0.0.0:4444->4444/tcp selenoid

  7. We also have compared these 2 containers (auto install by "From selenoid/chrome" and 1 is 4 manual steps), the PORTS are different (4444/tcp and 0.0.0.0:4444->4444/tcp), maybe this is the root cause.

  8. We also get suggestions to manual execute "docker build run -p 4444:4444 ..." during selenoid container building process, but this is not easy/suggest to do it because:
    We don't find a way to execute this cmd in dockerfile or jenkinsfile on real-time by now. If you known, please share to me.
    and manual steps to execute it on host, it will cause extra manul efforts, which cannot meet our goals to run it automatically.

Latest two opera images

Running any of the latest two versions of opera docker images gives a nifty error message:

node:11596) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[15:10:44] I/launcher - Running 1 instances of WebDriver
[15:10:44] I/hosted - Using the selenium server at http://:@localhost:4444/wd/hub
[15:10:45] E/launcher - unknown error: cannot find Opera binary
  (Driver info: OperaDriver=2.32 (cfa164127aab5f93e5e47d9dcf8407380eb42c50),platform=Linux 4.4.0-101-generic x86_64)
[15:10:45] E/launcher - WebDriverError: unknown error: cannot find Opera binary
  (Driver info: OperaDriver=2.32 (cfa164127aab5f93e5e47d9dcf8407380eb42c50),platform=Linux 4.4.0-101-generic x86_64)
    at Object.checkLegacyResponse ($HOME\node_modules\selenium-webdriver\lib\error.js:546:15)
    at parseHttpResponse ($HOME\node_modules\selenium-webdriver\lib\http.js:509:13)
    at doSend.then.response ($HOME\node_modules\selenium-webdriver\lib\http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.createSession()
  at Function.createSession ($HOME\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
  at createDriver ($HOME\node_modules\selenium-webdriver\index.js:170:33)
  at Builder.build ($HOME\node_modules\selenium-webdriver\index.js:635:14)
  at Hosted.getNewDriver ($HOME\node_modules\protractor\built\driverProviders\driverProvider.js:53:33)
  at Runner.createBrowser ($HOME\node_modules\protractor\built\runner.js:195:43)
  at q.then.then ($HOME\node_modules\protractor\built\runner.js:339:29)
  at _fulfilled ($HOME\node_modules\protractor\node_modules\q\q.js:834:54)
  at self.promiseDispatch.done ($HOME\node_modules\protractor\node_modules\q\q.js:863:30)
  at Promise.promise.promiseDispatch ($HOME\node_modules\protractor\node_modules\q\q.js:796:13)
  at $HOME\node_modules\protractor\node_modules\q\q.js:556:49
  at runSingle ($HOME\node_modules\protractor\node_modules\q\q.js:137:13)
  at flush ($HOME\node_modules\protractor\node_modules\q\q.js:125:13)
  at _combinedTickCallback (internal/process/next_tick.js:131:7)
  at process._tickCallback (internal/process/next_tick.js:180:9)
  at Function.Module.runMain (module.js:611:11)
  at startup (bootstrap_node.js:158:16)
  at bootstrap_node.js:598:3

[15:10:45] E/launcher - Process exited with error code 199

All it tells me is that something is strange with the docker image.

It's running latest and greatest selenoid from today with the following capabilities translated to the real selenium capabilities:

Protractor-options:  { sut: 'http://baseurl',
  browser:
   { name: 'opera',
     version: '',
     vnc: { enabled: true },
     recording: { name: 'protractor-test.mp4', enabled: false } },
  selenium: { port: '4444', host: 'localhost', username: '', password: '' },
  specs: [ '**/*.js' ] }

Add binary to wait for window manager

#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>

int OnWMDetected(Display* display, XErrorEvent* e) {
        exit(0);
}

int main() {
    Display *display = XOpenDisplay(NULL);
    if (display == NULL) {
        exit(1);
    }
    XSetErrorHandler(&OnWMDetected);
    XSelectInput(display, DefaultRootWindow(display), SubstructureRedirectMask | SubstructureNotifyMask);
    XSync(display, 1);
    exit(-1);
}

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://172.17.0.1:4444/wd/hub/session/1e5f379f0532f667f3bf7505a142a91b/url timed out after 60 seconds.

Not sure this is a bug, please double check. If not, please specify the correct/supported way. Thanks

1.Setup Selenoid container on host automatically:
curl -s https://aerokube.com/cm/bash | bash && ./cm selenoid start --browser "chrome"

  1. We can see the container created successfully
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    4faae28f028e aerokube/selenoid:1.6.2 "/usr/bin/selenoid -…" 19 minutes ago Up 19 minutes 0.0.0.0:4444->4444/tcp selenoid

and it's container logs:
2018/07/06 05:23:19 [-] [INIT] [Loading configuration files...]
2018/07/06 05:23:19 [-] [INIT] [Loaded configuration from /etc/selenoid/browsers.json]
2018/07/06 05:23:19 [-] [INIT] [Using default containers log configuration because of: read error: open config/container-logs.json: no such file or directory]
2018/07/06 05:23:19 [-] [INIT] [Using Docker API version: 1.37]
2018/07/06 05:23:19 [-] [INIT] [Timezone: Local]
2018/07/06 05:23:19 [-] [INIT] [Video Dir: /opt/selenoid/video]
2018/07/06 05:23:19 [-] [INIT] [Listening on :4444]

curl http://localhost:4444/status
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"66.0":{},"67.0":{}},"firefox":{"59.0":{},"60.0":{}},"opera":{"52.0":{},"53.0":{}}}}

curl http://localhost:4444/wd/hub
Moved Permanently.

  1. Initialized remote web driver as below
    var url = "http://172.17.0.1:4444/wd/hub";
    driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());

Notes: 172.17.0.1 is docker0 ip

  1. We run selenoid case in pipeline: jenkinsfile -> dockerfile, initial remote web driver failed with below error message:

2018/07/06 05:14:05 [0] [CREATING_CONTAINER] [selenoid/vnc_chrome:67.0]
2018/07/06 05:14:05 [0] [SERVICE_STARTUP_FAILED] [create container: Error: No such image: selenoid/vnc_chrome:67.0]

Notes: It should be installed during step 1 automatically, right?

  1. So we install image: selenoid/vnc_chrome:67.0 manually on host before run step 1
    docker pull selenoid/vnv_chrome:67.0

Notes: docker pull selenoid/vnc_chrome doesn't work for us, normally it should auto go the latest one, right?

  1. And then run case again, but still failed with timeout errors:

Error Message:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://172.17.0.1:4444/wd/hub/session/1e5f379f0532f667f3bf7505a142a91b/url timed out after 60 seconds.
---- System.Net.WebException : The operation has timed out.
Stack Trace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.set_Url(String value)
at SM_Regression.TestScripts.IncidentManagement.INC_create_001.step_001_OpenNewIncident() in /tmp/jenkins/data/docker/workspace/Selenoid-job/SM_Regression/TestScripts/IncidentManagement/INC_create_001.cs:line 40
----- Inner Stack Trace -----
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)

The ability to run in net=host mode

In the current implementation, the driver port inside the container is hardcoded. Therefore, it is not possible to run the container on the network host

I think this behavior can be fixed by adding an environment variable (--port=$SELENOID_PORT) in the entrypoint.sh file

Adobe Flash Player applications don't start with latest images of chrome browser, need to restart browser.

Description
When we are trying to open the application it's downloading and instaling Flash player, but after that browser asks to restart its self.
Capabitities that are used for chrome browser to work with:

var options = new ChromeOptions {BrowserVersion ="66.0", PlatformName = PlatformType.Any};
options.AddArgument("--disable-notifications");
options.AddArgument("--allow-outdated-plugins");
options.AddArgument("disable-infobars");
options.AddUserProfilePreference("profile.default_content_setting_values.plugins", 1);
options.AddUserProfilePreference("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
options.AddUserProfilePreference("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);
var caps = options.ToCapabilities() as DesierdCapabilities;
caps.SetCapabilitiey("enableVnc", true);
var remoteDriver = new RemoteWebDriver(new Uri(GridUrl), caps);

Images used:

  • selenoid/chrome:65.0
  • selenoid/chrome:66.0
  • selenoid/chrome:67.0

Standalone Chrome in Docker

I'm trying to use the Selenoid Docker images for Chrome directly, without using the Selenoid Hub. To that, I simply start a Chrome in Docker with the following command:

docker run --rm -p 4444:4444 selenoid/vnc:chrome_64.0

Then, I have a JUnit 4 test as follows:

import static org.junit.Assert.assertTrue;
import static org.openqa.selenium.remote.DesiredCapabilities.chrome;

import java.net.MalformedURLException;
import java.net.URL;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;

public class RemoteTest {

    private WebDriver driver;

    @Before
    public void setup() throws MalformedURLException {
        driver = new RemoteWebDriver(new URL("http://localhost:4444/"),
                chrome());
    }

    @After
    public void teardown() {
        if (driver != null) {
            driver.quit();
        }
    }

    @Test
    public void test() {
        driver.get("https://en.wikipedia.org/wiki/Main_Page");
        assertTrue(
                driver.getTitle().equals("Wikipedia, the free encyclopedia"));
    }

}

Unfortunately it does not work. The container logs are the following:

 --- x11vnc loop: 1 ---

Starting ChromeDriver 2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881) on port 4444
All remote connections are allowed. Use a whitelist instead!
 --- x11vnc loop: waiting for: 34

PORT=5900
[1517227546.481][INFO]: COMMAND InitSession {
   "capabilities": {
      "desiredCapabilities": {
         "browserName": "chrome",
         "platform": "ANY",
         "version": ""
      },
      "firstMatch": [ {
         "browserName": "chrome"
      } ]
   },
   "desiredCapabilities": {
      "browserName": "chrome",
      "platform": "ANY",
      "version": ""
   }
}
[1517227546.481][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[1517227546.481][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[1517227546.482][INFO]: Launching chrome: /usr/bin/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --load-extension=/tmp/.org.chromium.Chromium.IznbZ4/internal --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12627 --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.org.chromium.Chromium.ptNi6n data:,
[1517227546.482][DEBUG]: DevTools request: http://localhost:12627/json/version
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
[1517227546.617][DEBUG]: DevTools request failed
[1517227546.667][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.668][DEBUG]: DevTools request failed
[1517227546.718][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.719][DEBUG]: DevTools request failed
[1517227546.769][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.771][DEBUG]: DevTools request failed
[1517227546.821][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.822][DEBUG]: DevTools request failed
[1517227546.872][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.873][DEBUG]: DevTools request failed
[1517227546.924][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.925][DEBUG]: DevTools request failed
[1517227546.975][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227546.976][DEBUG]: DevTools request failed
[1517227547.026][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.027][DEBUG]: DevTools request failed
[1517227547.077][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.078][DEBUG]: DevTools request failed
[1517227547.128][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.129][DEBUG]: DevTools request failed
[1517227547.179][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.181][DEBUG]: DevTools request failed
[1517227547.231][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.232][DEBUG]: DevTools request failed
[1517227547.282][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.283][DEBUG]: DevTools request failed
[1517227547.333][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.335][DEBUG]: DevTools request failed
[1517227547.385][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.386][DEBUG]: DevTools request failed
[1517227547.437][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.438][DEBUG]: DevTools request failed
[1517227547.488][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.489][DEBUG]: DevTools request failed
[1517227547.540][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.540][DEBUG]: DevTools request failed
[1517227547.590][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.590][DEBUG]: DevTools request failed
[1517227547.641][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.641][DEBUG]: DevTools request failed
[1517227547.691][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.692][DEBUG]: DevTools request failed
[1517227547.742][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.743][DEBUG]: DevTools request failed
[1517227547.793][DEBUG]: DevTools request: http://localhost:12627/json/version
[1517227547.795][DEBUG]: DevTools request failed

It continues stalled and I have to stop manually the container. I tried to solve for similar issues but I did not find the solution yet.

Any idea about this?

Thank you very much in advance.

How to run selenium case on host Selenoid container by jenkins pipeline?

We've setup the Selenoid container on host follow below steps in "Get Started" document:
1.Create config/browsers.json configuration file with content:
{
"chrome": {
"default": "latest",
"versions": {
"latest": {
"image": "selenoid/chrome",
"port": "4444",
"path": "/"
}
}
}
}

2.Pull browser Docker image:
$ docker pull selenoid/chrome
3. start Selenoid container
docker run -d --name selenoid -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v pwd/config/:/etc/selenoid/:ro aerokube/selenoid:latest-release
4. check status
_docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc4444a35c88 aerokube/selenoid:latest-release "/usr/bin/selenoid -…" 9 minutes ago Up 9 minutes 0.0.0.0:4444->4444/tcp selenoid

curl http://localhost:4444/status
{"total":5,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"latest":{}}}}_

  1. We've initial remote webdriver in dotnetcore code:
    var url = "http://localhost:4444/";
    driver = new RemoteWebDriver(new Uri(url), DesiredCapabilities.Chrome());
  2. Upload and download source code from Github, and Run it by Jenkins pipeline which will call a Jenkins file.

Questions:
How to run the selenium case in above created/prepared solenoid container (which existed on host) by Jenkins pipeline?

selenoid/chrome: An error occurred while sending the request. Couldn't connect to server

We're just trying to run selenium auto-case in Selenoid container, but failed with request timeout.
_

Starting ChromeDriver 2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf) on port 35182
Only local connections are allowed.
An error occurred while sending the request. Couldn't connect to server

The HTTP request to the remote WebDriver server for URL http://localhost:35182/session timed out after 60 seconds.

_

ChromeDriver 2.42

# docker pull selenoid/vnc_chrome:69.0
69.0: Pulling from selenoid/vnc_chrome
Digest: sha256:7ac776ee64e275fa2b0acfe35d7faed14c18a9677c107fa12c59e8453fca1dda
Status: Image is up to date for selenoid/vnc_chrome:69.0
# docker run -it selenoid/vnc_chrome:69.0 bash
Waiting xvfb...
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 4444
All remote connections are allowed. Use a whitelist instead!

It will be grade to upgrade chrome images with latest driver!

Latest Release: ChromeDriver 2.42

Changes include:
Fixed ClickEelement in Mobile Emulation
Fixed whitelisted IPs with IPv4
Fixed starting ChromeDriver with whitelisted-ips flag on Mac OS
Fixed SetTimeout to accept both pre-W3C and W3C formats
Fixed take element screenshot
Fixed ChromeDriver is looking for Chrome binaries in a system PATH as well
Fixed Maximize window and Full Screen
Implemented log-replay functionality. ( Does not work for Android and Remote Browser yet )
Fixed some error codes were not compliant to W3C standard
Fixed console.log with multiple arguments not handled properly
Fixed GetElementRect should allow doubles
Fixed touch emulation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.