From 831ce399a089e8d8a61078617ba9973e877d9245 Mon Sep 17 00:00:00 2001 From: "Garcia,Ana_Maria (IT EDS) BI-ES-S" Date: Tue, 17 Dec 2024 10:35:38 +0100 Subject: [PATCH] GebConfig - HtmlUnitDriver proxy --- e2e-spock-geb/files/src/test/resources/GebConfig.groovy | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/e2e-spock-geb/files/src/test/resources/GebConfig.groovy b/e2e-spock-geb/files/src/test/resources/GebConfig.groovy index 518640f3..2f775af9 100644 --- a/e2e-spock-geb/files/src/test/resources/GebConfig.groovy +++ b/e2e-spock-geb/files/src/test/resources/GebConfig.groovy @@ -4,6 +4,7 @@ import io.appium.java_client.android.AndroidDriver import io.appium.java_client.ios.IOSDriver import org.openqa.selenium.MutableCapabilities import org.openqa.selenium.htmlunit.HtmlUnitDriver +import org.openqa.selenium.Proxy import helpers.* // Load application properties from application.properties file @@ -27,6 +28,14 @@ environments { return webClient } } + def env = System.getenv() + if(env.HTTP_PROXY) { + Proxy proxy = new Proxy(); + URL url = new URL(env.HTTP_PROXY); + proxy.setHttpProxy("${url.getHost()}:${url.getPort()}"); + proxy.setNoProxy(env.NO_PROXY) + driver.setProxySettings(proxy); + } return driver } }