Skip to content

Commit

Permalink
GebConfig - HtmlUnitDriver proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
garcanam committed Dec 17, 2024
1 parent e24d63a commit 831ce39
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions e2e-spock-geb/files/src/test/resources/GebConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
Expand Down

0 comments on commit 831ce39

Please sign in to comment.