N
N
Nikifor Pcholkin2019-04-04 16:07:12
Google Chrome
Nikifor Pcholkin, 2019-04-04 16:07:12

Why is ChromeDriver trying to open the site via https?

I'm running tests in codeception via docker. The application itself starts through the built-in web server in PHP (php -S 0.0.0.0:8080), from containers with selenium/node-chrome and selenium/hub I can pull the link to the site via curl :

selenium/hub
[email protected]:/$ curl -v http://app:8080
* Rebuilt URL to: http://app:8080/
*   Trying 172.23.0.2...
* TCP_NODELAY set
* Connected to app (172.23.0.2) port 8080 (#0)
> GET / HTTP/1.1
> Host: app:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Host: app:8080
< Date: Thu, 04 Apr 2019 12:59:58 +0000
< Connection: close
< X-Powered-By: PHP/7.3.3
< Content-type: text/html; charset=UTF-8
<
* Closing connection 0
Hello World!

selenium/node-chrome
[email protected]:/$ curl -v http://app:8080
* Rebuilt URL to: http://app:8080/
*   Trying 172.23.0.2...
* TCP_NODELAY set
* Connected to app (172.23.0.2) port 8080 (#0)
> GET / HTTP/1.1
> Host: app:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Host: app:8080
< Date: Thu, 04 Apr 2019 13:01:05 +0000
< Connection: close
< X-Powered-By: PHP/7.3.3
< Content-type: text/html; charset=UTF-8
<
* Closing connection 0
Hello World!


But during the tests it can not connect, I get an error
This site can't be reached app unexpectedly closed the connection.

And here is the log in the web server console:
app_1           | [Thu Apr  4 13:02:23 2019] 172.23.0.4:46120 Invalid request (Unsupported SSL request)
app_1           | [Thu Apr  4 13:02:23 2019] 172.23.0.4:46122 Invalid request (Unsupported SSL request)
app_1           | [Thu Apr  4 13:02:23 2019] 172.23.0.4:46124 Invalid request (Unsupported SSL request)
app_1           | [Thu Apr  4 13:02:23 2019] 172.23.0.4:46126 Invalid request (Unsupported SSL request)

acceptance.suite.yml
actor: AcceptanceEngineer
modules:
    enabled:
        - WebDriver:
            browser: chrome
            url: http://app:8080
            host: selenium-hub
            port: 4444
        - \Helper\Acceptance

docker-composer.yml
version: "3"

services:
  app:
    image: php:latest
    volumes:
      - ./:/app
    working_dir: /app
    command: php -S 0.0.0.0:8080

  selenium-hub:
    image: selenium/hub:3.141.59-mercury
    depends_on:
      - app
    ports:
      - 4444:4444

  chrome:
    image: selenium/node-chrome:3.141.59-mercury
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
      - app
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikifor Pcholkin, 2019-04-04
@hanas

As they wrote in one parable from

Koran
Если гора не идет к Магомету, то Магомет идет к горе

The solution turned out to be easier than I thought. I replaced the standard PHP builtin web server with mpyw/php-hyper-builtin-server
docker-compose.yml
version: "3"

services:
  app:
    image: php:latest
    volumes:
      - ./:/app
    working_dir: /app
    command: vendor/bin/hyper-run -s 0.0.0.0:8080
    depends_on:
      - selenium-hub

  selenium-hub:
    image: selenium/hub:3.141.59-mercury
    depends_on:
      - chrome
    ports:
      - 4444:4444

  chrome:
    image: selenium/node-chrome:3.141.59-mercury
    volumes:
      - /dev/shm:/dev/shm
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question