So I have this automation test which I want to run against a local physical device to test the concept. The test is a C#/Selenium script thus
The device is a Galaxy Tab S 10 and UDB debugging is enabled and this device can be seen in Windows Explorer
And in Android Studio thus
Device name is Tab, model number SM-T805 and Android version is 5.0.2
Now when I try to connect to the device in Visual Studio with this code
var options = new ChromeOptions();
options.PlatformName = "Android";
options.AddAdditionalChromeOption("deviceName", "Tab");
options.AddAdditionalChromeOption("PlatformName", "Android");
options.AddAdditionalChromeOption("platformVersion", "5.0.2");
options.AddAdditionalChromeOption("isRealMobile", true);
options.AddAdditionalChromeOption("network", false);
Uri url = new Uri("http://127.0.0.1:5037/wd/hub");
_driver = new RemoteWebDriver(url, options);
I get this error
OpenQA.Selenium.WebDriverException: 'An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://127.0.0.1:5037/wd/hub/session. The exception message was: An error occurred while sending the request.'
So my first thought is, am I using the correct port (5037) and how do I confirm what port the tab is listening on?
Apart from that has anyone got any ideas what I am doing wrong please? Thanks in advance….
This is the call stack
TestApp.Regression.dll!TheTest.Hooks.BeforeTheMobileFeature(string title, string osver, string device, string browser, string deviceOrientation) Line 91 C#
TestApp.Regression.dll!TheTest.Hooks.BeforeFeatureTabA7(TechTalk.SpecFlow.FeatureContext featureContext) Line 52 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Private.CoreLib.dll!System.Delegate.DynamicInvokeImpl(object[] args) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeBindingDelegateSync(System.Delegate bindingDelegate, object[] invokeArgs) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeDelegateSynchronously(System.Delegate bindingDelegate, object[] invokeArgs) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(TechTalk.SpecFlow.Bindings.IBinding binding, TechTalk.SpecFlow.Infrastructure.IContextManager contextManager, object[] arguments, TechTalk.SpecFlow.Tracing.ITestTracer testTracer, out System.TimeSpan duration) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.InvokeHook(TechTalk.SpecFlow.Bindings.IBindingInvoker invoker, TechTalk.SpecFlow.Bindings.IHookBinding hookBinding, TechTalk.SpecFlow.Bindings.HookType hookType) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(TechTalk.SpecFlow.Bindings.HookType hookType) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureStart(TechTalk.SpecFlow.FeatureInfo featureInfo) Unknown
TechTalk.SpecFlow.dll!TechTalk.SpecFlow.TestRunner.OnFeatureStart(TechTalk.SpecFlow.FeatureInfo featureInfo) Unknown
TestApp.Regression.dll!TestApp.Regression.Features.GalaxyTab7Feature.FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Extensions.MethodInfoExtensions.InvokeAsSynchronousTask(System.Reflection.MethodInfo methodInfo, object classInstance, object[] parameters) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodRunner.Execute() Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner.RunSingleTest(Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel.TestMethod testMethod, System.Collections.Generic.IDictionary<string, object> testContextProperties) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsWithTestRunner(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestExecutionRecorder testExecutionRecorder, string source, System.Collections.Generic.IDictionary<string, object> sourceLevelParameters, Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner testRunner) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSource(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, string source, bool isDeploymentDone) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, bool isDeploymentDone) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTests(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle, Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.TestRunCancellationToken runCancellationToken) Unknown
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll!Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTests(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IRunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle) Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities.LazyExtension<Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.ITestExecutor, Microsoft.VisualStudio.TestPlatform.Common.Interfaces.ITestExecutorCapabilities> executor, System.Tuple<System.Uri, string> executorUri, Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Adapter.RunContext runContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter.IFrameworkHandle frameworkHandle) Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(System.Collections.Generic.IEnumerable<System.Tuple<System.Uri, string>> executorUriExtensionMap, long totalTests) Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestsInternal() Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTests() Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.ExecutionManager.StartTestRun(System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> tests, string package, string runSettings, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol.TestExecutionContext testExecutionContext, Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ITestCaseEventsHandler testCaseEventsHandler, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IInternalTestRunEventsHandler runEventsHandler) Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestHandler.OnMessageReceived.AnonymousMethod__4() Unknown
Microsoft.TestPlatform.CrossPlatEngine.dll!Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestHandler..ctor.AnonymousMethod__30_2(System.Action action) Unknown
Microsoft.TestPlatform.CoreUtilities.dll!Microsoft.VisualStudio.TestPlatform.Utilities.JobQueue<System.Action>.SafeProcessJob(System.Action job) Unknown
Microsoft.TestPlatform.CoreUtilities.dll!Microsoft.VisualStudio.TestPlatform.Utilities.JobQueue<System.Action>.BackgroundJobProcessor(string threadName) Unknown
Microsoft.TestPlatform.CoreUtilities.dll!Microsoft.VisualStudio.TestPlatform.Utilities.JobQueue<System.__Canon>..ctor.AnonymousMethod__16_0() Unknown
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread) Unknown