amazon-web-servicesproxyaws-device-farm

How can i solve proxy problem when using AWS device farm?


I'm trying to execute aws device farm example code that we can get below site. https://docs.aws.amazon.com/devicefarm/latest/testgrid/getting-started-local.html

// Import the AWS SDK for Java 2.x Device Farm client:
...

// in your tests ...
public class MyTests {
  // ... When you set up your test suite
  private static RemoteWebDriver driver;

  @Before
  void setUp() {
    String myProjectARN = "...";
    DeviceFarmClient client  = DeviceFarmClient.builder().region(Region.US_WEST_2).build();
    CreateTestGridUrlRequest request = CreateTestGridUrlRequest.builder()
      .expiresInSeconds(300)
      .projectArn(myProjectARN)
      .build();
    CreateTestGridUrlResponse response = client.createTest.GridUrl(request);
    URL testGridUrl = new URL(response.url());
    // You can now pass this URL into RemoteWebDriver.
    WebDriver driver = new RemoteWebDriver(testGridUrl, DesiredCapabilities.firefox());
  }
  
  @After
  void tearDown() {
    // make sure to close your WebDriver:
    driver.quit();
  }

}

After executing above codes, the error was occurred and the message is like this.

java.net.UnknownHostException: devicefarm.us-westt-2.amazonaws.com

I guess the code can't resolve host because of proxy server. How can i resolve this problem?

Thanks.


Solution

  • Can you please confirm which line throws java.net.UnknownHostException: devicefarm.us-westt-2.amazonaws.com. Is it client.createTest.GridUrl(request) or WebDriver driver = new RemoteWebDriver(testGridUrl, DesiredCapabilities.firefox());

    If it is the client.createTest.GridUrl(request), then please follow Proxy Configuration mentioned at https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/section-client-configuration.html