dotnet-client icon indicating copy to clipboard operation
dotnet-client copied to clipboard

Mobile Tests Behind a Proxy

Open benwalpole opened this issue 2 years ago • 1 comments

Description

We are trying to run some automated tests for our Xamarin based iOS app using the IOSDriver within Visual Studio for Mac.

The error we are getting when we run them is (I've sanitised to remove the URL we are actually trying to send the request to).

A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL https://<Test Host URL>. The status of the exception was NameResolutionFailure, and the message was: nodename nor servname provided, or not known nodename nor servname provided, or not known

Because our machines are behind a proxy we often see DNS errors like this when the code sending the request is unaware of the proxy.

We've tried various approached to setting the proxy, such as HttpClient.DefaultProxy and OpenQA.Selenium.Proxy but the error still persists.

Are there any other ways to tell the tests that they are operating behind a proxy?

Environment

  • .NET client build version or git revision if you use some shapshot: 4.2.1
  • Appium server version or git revision if you use some shapshot:
  • Desktop OS/version used to run Appium if necessary: OS X 11.6
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: Simulator

benwalpole avatar Jun 07 '22 10:06 benwalpole

HttpCommandExecutor executor = new HttpCommandExecutor(remoteUrl, TimeSpan.FromMinutes(5))
{
    Proxy = proxy
};
iOSDriver = new IOSDriver<AppiumWebElement>(executor, driverOptions);

This works for me, remoteUrl is an Appium-Server that is external and only accessible through a corporate proxy.

broetchenrackete36 avatar Aug 09 '22 21:08 broetchenrackete36

@benwalpole does the solution provided suites your needs?

Dor-bl avatar Nov 05 '22 13:11 Dor-bl

Closed as no response

Dor-bl avatar Nov 19 '22 09:11 Dor-bl