В общем есть вот такой тест простой
package com.tw1911.test1;
import com.beust.jcommander.Parameter;
import com.codeborne.selenide.*;
import com.codeborne.selenide.logevents.SelenideLogger;
import io.qameta.allure.selenide.AllureSelenide;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.*;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;
public class GoogleSearchTests {
@DataProvider(name = "browser-provider", parallel = true)
public Object[] provide() throws Exception {
return new Object[]{"firefox", "chrome"};
}
@Test(dataProvider = "browser-provider", threadPoolSize = 2)
public void testGoogleSearch(String browser){
SelenideDriver driver = new SelenideDriver(new SelenideConfig()
.browser(browser)
.driverManagerEnabled(true)
.remote("http://selenoid:4444/wd/hub")
.headless(true));
driver.open("http://google.com");
driver.$(By.name("q")).setValue("Тест");
driver.$(By.xpath("//input[@value='Поиск в Google']")).click();
driver.$(By.id("resultStats")).shouldBe(Condition.visible);
driver.close();
}
@BeforeClass
public static void setUp(){
SelenideLogger.addListener("allure", new AllureSelenide());
}
@AfterClass
public static void tearDown(){
SelenideLogger.removeListener("allure");
}
}
Хочу запускать его на Selenoid. Сливаю образа браузеров, подготовил browsers.json, запускаю Selenoid:
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
Докер на удаленном хосте. Прописал адрес в конфиг драйвера в .remote, ну короче видно из кода.
Запускаю - все работает.
Дальше что хочу - что бы и тесты запускались в каком то контейнере. Беру образ openjdk:8, ну короче Dockerfile:
FROM openjdk:8
CMD git clone https://github.com/tw1911/test1.git /root/test && cd /root/test && chmod +x ./gradlew && ./gradlew test
Собираю образ запускаю:
docker run --link selenoid:selenoid TestImage
В итоге получаю ошибку
Gradle suite > Gradle test > com.tw1911.test1.GoogleSearchTests.testGoogleSearch[0](firefox) FAILED
org.openqa.selenium.WebDriverException at GoogleSearchTests.java:30
Gradle suite > Gradle test > com.tw1911.test1.GoogleSearchTests.testGoogleSearch[0](chrome) FAILED
org.openqa.selenium.WebDriverException at GoogleSearchTests.java:30
2 tests completed, 2 failed
Это происходит на строке driver.open
Может быть я что то забываю пробросить или дела в openjdk8?
Или может быть так вообще не стоит делать, как я?
Добавлю еще что в логах самого Selenoid как бы все ок
2018/12/04 20:08:10 [-] [NEW_REQUEST] [unknown] [172.17.0.3]
2018/12/04 20:08:10 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.3]
2018/12/04 20:08:10 [149] [LOCATING_SERVICE] [firefox] []
2018/12/04 20:08:10 [-] [DEFAULT_VERSION] [Using default version: latest]
2018/12/04 20:08:10 [149] [USING_DOCKER] [firefox] [latest]
2018/12/04 20:08:10 [149] [CREATING_CONTAINER] [selenoid/firefox]
2018/12/04 20:08:10 [-] [NEW_REQUEST] [unknown] [172.17.0.3]
2018/12/04 20:08:10 [-] [NEW_REQUEST_ACCEPTED] [unknown] [172.17.0.3]
2018/12/04 20:08:10 [150] [LOCATING_SERVICE] [chrome] []
2018/12/04 20:08:10 [-] [DEFAULT_VERSION] [Using default version: latest]
2018/12/04 20:08:10 [150] [USING_DOCKER] [chrome] [latest]
2018/12/04 20:08:10 [150] [CREATING_CONTAINER] [selenoid/chrome]
2018/12/04 20:08:10 [150] [STARTING_CONTAINER] [selenoid/chrome] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02]
2018/12/04 20:08:10 [149] [STARTING_CONTAINER] [selenoid/firefox] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602]
2018/12/04 20:08:12 [149] [CONTAINER_STARTED] [selenoid/firefox] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602] [1.95s]
2018/12/04 20:08:12 [150] [CONTAINER_STARTED] [selenoid/chrome] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02] [2.03s]
2018/12/04 20:08:15 [149] [SERVICE_STARTED] [selenoid/firefox] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602] [2.75s]
2018/12/04 20:08:15 [149] [PROXY_TO] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602] [http://172.17.0.5:4444/wd/hub]
2018/12/04 20:08:15 [149] [SESSION_ATTEMPTED] [http://172.17.0.5:4444/wd/hub] [1]
2018/12/04 20:08:15 [150] [SERVICE_STARTED] [selenoid/chrome] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02] [2.96s]
2018/12/04 20:08:15 [150] [PROXY_TO] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02] [http://172.17.0.4:4444]
2018/12/04 20:08:15 [150] [SESSION_ATTEMPTED] [http://172.17.0.4:4444] [1]
2018/12/04 20:08:45 [149] [SESSION_ATTEMPT_TIMED_OUT] [30s]
2018/12/04 20:08:45 [149] [SESSION_FAILED] [http://172.17.0.5:4444/wd/hub] [New session attempts retry count exceeded]
2018/12/04 20:08:45 [149] [REMOVING_CONTAINER] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602]
2018/12/04 20:08:45 [150] [SESSION_ATTEMPT_TIMED_OUT] [30s]
2018/12/04 20:08:45 [150] [SESSION_FAILED] [http://172.17.0.4:4444] [New session attempts retry count exceeded]
2018/12/04 20:08:45 [150] [REMOVING_CONTAINER] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02]
2018/12/04 20:09:01 [149] [CONTAINER_REMOVED] [745b67f246f5a2d40c0b158f41308ef8acb27b0ec1838fce4f8baaae6b265602]
2018/12/04 20:09:01 [150] [CONTAINER_REMOVED] [3f4b25d79f5244bff4322c79ab3e7611c905bdccc7e59334637d6b879684ab02]