From 238e18f9a2b04e83e48134927ec6bfd1c4c1e129 Mon Sep 17 00:00:00 2001 From: Tejas Shah Date: Thu, 23 Nov 2017 12:47:15 +0530 Subject: [PATCH] update condition | remove realMobile, automationName cap --- .../Program.cs | 5 ++--- .../csharp-appium-app-browserstack/Program.cs | 5 ++--- .../Program.cs | 6 ++---- .../csharp-appium-app-browserstack/Program.cs | 19 +++++++++++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/android/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs b/android/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs index bef8c67..4d4be5a 100644 --- a/android/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs +++ b/android/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs @@ -12,8 +12,8 @@ namespace BrowserStackAppiumLocalTest class MainClass { - readonly static string userName = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); - readonly static string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); + readonly static string userName = "BROWSERSTACK_USERNAME"; + readonly static string accessKey = "BROWSERSTACK_ACCESS_KEY"; public static void Main(string[] args) @@ -30,7 +30,6 @@ public static void Main(string[] args) caps.SetCapability("browserstack.user", userName); caps.SetCapability("browserstack.key", accessKey); - caps.SetCapability("realMobile", true); caps.SetCapability("device", "Google Pixel"); caps.SetCapability("browserstack.local", true); caps.SetCapability("app", "bs://"); diff --git a/android/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs b/android/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs index ca6e1bf..d97f386 100644 --- a/android/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs +++ b/android/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs @@ -11,8 +11,8 @@ namespace BrowserStackAppiumSingleTest class MainClass { - readonly static string userName = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); - readonly static string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); + readonly static string userName = "BROWSERSTACK_USERNAME"; + readonly static string accessKey = "BROWSERSTACK_ACCESS_KEY"; public static void Main(string[] args) @@ -21,7 +21,6 @@ public static void Main(string[] args) caps.SetCapability("browserstack.user", userName); caps.SetCapability("browserstack.key", accessKey); - caps.SetCapability("realMobile", true); caps.SetCapability("device", "Google Pixel"); caps.SetCapability("app", "bs://"); diff --git a/ios/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs b/ios/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs index 0336be3..2c21460 100644 --- a/ios/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs +++ b/ios/csharp-appium-local-app-browserstack/csharp-appium-local-app-browserstack/Program.cs @@ -12,8 +12,8 @@ namespace BrowserStackAppiumLocalTest class MainClass { - readonly static string userName = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); - readonly static string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); + readonly static string userName = "BROWSERSTACK_USERNAME"; + readonly static string accessKey = "BROWSERSTACK_ACCESS_KEY"; public static void Main(string[] args) @@ -30,9 +30,7 @@ public static void Main(string[] args) caps.SetCapability("browserstack.user", userName); caps.SetCapability("browserstack.key", accessKey); - caps.SetCapability("realMobile", true); caps.SetCapability("device", "iPhone 7"); - caps.SetCapability("automationName", "XCUITest"); caps.SetCapability("browserstack.local", true); caps.SetCapability("app", "bs://"); diff --git a/ios/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs b/ios/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs index efacc81..ad9c168 100644 --- a/ios/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs +++ b/ios/csharp-appium-single-app-browserstack/csharp-appium-app-browserstack/Program.cs @@ -11,8 +11,8 @@ namespace BrowserStackAppiumSingleTest class MainClass { - readonly static string userName = Environment.GetEnvironmentVariable("BROWSERSTACK_USERNAME"); - readonly static string accessKey = Environment.GetEnvironmentVariable("BROWSERSTACK_ACCESS_KEY"); + readonly static string userName = "BROWSERSTACK_USERNAME"; + readonly static string accessKey = "BROWSERSTACK_ACCESS_KEY"; public static void Main(string[] args) @@ -21,8 +21,6 @@ public static void Main(string[] args) caps.SetCapability("browserstack.user", userName); caps.SetCapability("browserstack.key", accessKey); - caps.SetCapability("realMobile", true); - caps.SetCapability("automationName", "XCUITest"); caps.SetCapability("device", "iPhone 7"); caps.SetCapability("app", "bs://"); IOSDriver driver = new IOSDriver (new Uri("http://hub-cloud.browserstack.com/wd/hub"), caps); @@ -45,10 +43,15 @@ public static void Main(string[] args) String matchedString = ""; foreach(IOSElement textElement in textElements) { - String textContent = textElement.Text; - if (textContent.Contains("not registered")) - { - matchedString = textContent; + try { + String textContent = textElement.Text; + if (textContent.Contains("not registered")) + { + matchedString = textContent; + } + } + catch (NullReferenceException) { + continue; } }