當前位置: 首頁>>代碼示例>>C#>>正文


C# Android.AndroidDriver類代碼示例

本文整理匯總了C#中OpenQA.Selenium.Appium.Android.AndroidDriver的典型用法代碼示例。如果您正苦於以下問題:C# AndroidDriver類的具體用法?C# AndroidDriver怎麽用?C# AndroidDriver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AndroidDriver類屬於OpenQA.Selenium.Appium.Android命名空間,在下文中一共展示了AndroidDriver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RunBeforeEach

		public void RunBeforeEach()
		{
			server.respondToInit ();
			DesiredCapabilities capabilities = new DesiredCapabilities();
            AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
			server.clear ();
		}
開發者ID:andreypetukhov,項目名稱:AppiumGigya,代碼行數:7,代碼來源:SessionTest.cs

示例2: StartingAndroidAppWithCapabilitiesAndServiceTest

        public void StartingAndroidAppWithCapabilitiesAndServiceTest()
        {
            string app = Apps.get("androidApiDemos");

            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(MobileCapabilityType.DeviceName, "Android Emulator");

            OptionCollector argCollector = new OptionCollector().AddArguments(GeneralOptionList.App(app))
                .AddArguments(GeneralOptionList.AutomationName(AutomationName.Appium));
            AppiumServiceBuilder builder = new AppiumServiceBuilder().WithArguments(argCollector);

            AndroidDriver<AppiumWebElement> driver = null;
            try
            {
                driver = new AndroidDriver<AppiumWebElement>(builder, capabilities);
                driver.CloseApp();
            }
            finally
            {
                if (driver != null)
                {
                    driver.Quit();
                }
            }
        }
開發者ID:FlawlessFalcon,項目名稱:sample-code,代碼行數:25,代碼來源:StartingAppLocallyTest.cs

示例3: GetCurrentActivityTestCase

 public void GetCurrentActivityTestCase()
 {
     AndroidDriver<IWebElement> driver = new AndroidDriver<IWebElement>(defaultUri, capabilities);
     server.respondTo("GET", "/appium/device/current_activity", ".activities.PeopleActivity");
     string activity = driver.CurrentActivity;
     Assert.AreEqual(activity, ".activities.PeopleActivity");
 }
開發者ID:jonstoneman,項目名稱:appium-dotnet-driver,代碼行數:7,代碼來源:MJsonMethodTest.cs

示例4: GetAppStringsTestCase

 public void GetAppStringsTestCase()
 {
     AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
     var data = "21343n2312j3jw";
     server.respondTo ("POST", "/appium/app/strings", data);
     var result = driver.GetAppStrings ();
     Assert.AreEqual (result, data);
 }
開發者ID:andreypetukhov,項目名稱:AppiumGigya,代碼行數:8,代碼來源:MJsonMethodTest.cs

示例5: EndTestCoverageTestCase

 public void EndTestCoverageTestCase()
 {
     AndroidDriver driver = new AndroidDriver(defaultUri, capabilities);
     var data = "21343n2312j3jw";
     server.respondTo ("POST", "/appium/app/end_test_coverage", data);
     var result = driver.EndTestCoverage ("android.intent.action.BOOT_COMPLETED", "/random/path");
     Assert.AreEqual (result, data);
 }
開發者ID:andreypetukhov,項目名稱:AppiumGigya,代碼行數:8,代碼來源:MJsonMethodTest.cs

示例6: BeforeAll

 public void BeforeAll()
 {
     DesiredCapabilities capabilities =
         Caps.getAndroid19Caps(Apps.get("androidApiDemosLocal"));
     Uri serverUri = AppiumServers.localURI;
     driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
     driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
 }
開發者ID:k-yamada,項目名稱:AppiumWindowsSample,代碼行數:8,代碼來源:AndroidSimpleTest.cs

示例7: InitBrowser

 public void InitBrowser()
 {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities.SetCapability("deviceName", "AF2");
     capabilities.SetCapability("app", "D:/BYTA/Framework/BYTA_AF_Framework_Task5/MobileTests/com.basecamp.bc3.apk");
     capabilities.SetCapability("appPackage", "com.basecamp.bc3");
     capabilities.SetCapability("appWaitActivity", "com.basecamp.bc3.activities.AuthChooserActivity");
     capabilities.SetCapability("unicodeKeyboard", true);
     driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
 }
開發者ID:AliakseiF,項目名稱:BYTA_AF_Framework,代碼行數:10,代碼來源:TestBase.cs

示例8: Main

        static void Main(string[] args)
        {
            AndroidDriver<AndroidElement> driver;
            var INIT_TIMEOUT_SEC = TimeSpan.FromSeconds(180);
            var Capabilities=new DesiredCapabilities();
            var serverUrl = new Uri("http://172.0.0.1:4723/wd/hub");

              //  Capabilities.SetCapability(CapabilityType.BrowserName,"");
            Capabilities.SetCapability(MobileCapabilityType.DeviceName,"Android");
            //Capabilities.SetCapability(MobileCapabilityType.AppActivity,"");
            //Capabilities.SetCapability(MobileCapabilityType.AppPackage,"");
            Capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.4.13");
            Capabilities.SetCapability(MobileCapabilityType.App,@"C:/sample-code/apps/ApiDemos-debug.apk");

            driver=new AndroidDriver<AndroidElement>(serverUrl,Capabilities,INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(INIT_TIMEOUT_SEC);

            driver.FindElementByName("Graphics").Click();
            driver.ScrollTo("FingerPaint", "android:id/list");
            driver.FindElementByName("FingerPaint").Click();
            AndroidElement element = driver.FindElementById("android:id/content");
            Point point = element.Coordinates.LocationInDom;
            Size size = element.Size;
            driver.Swipe
            (
                point.X + 5,
                point.Y + 5,
                point.X + size.Width - 5,
                point.Y + size.Height - 5,
                200
            );

            driver.Swipe
            (
                point.X + size.Width - 5,
                point.Y + 5,
                point.X + 5,
                point.Y + size.Height - 5,
                2000
            );

             driver.FindElementByName("Graphics").Click();
            driver.ScrollTo("OpenGL ES", "android:id/list").Click();
            //driver.FindElementByName("OpenGL ES").Click();
            driver.ScrollTo("Touch Rotate", "android:id/list").Click();
            //driver.FindElementByName("TouchRotate").Click();

            AndroidElement element1 = driver.FindElementById("android:id/content");
            driver.Pinch(element1);
            driver.Zoom(element1);

            Thread.Sleep(2000);

              driver.Quit();
        }
開發者ID:karlpig,項目名稱:AutomaticMobileFlux,代碼行數:55,代碼來源:Program.cs

示例9: Android

 public Android (string deviceID,string package,string activity)
 {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities.SetCapability(CapabilityType.BrowserName, "");
     capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.0");
     capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "4.4.2");
     capabilities.SetCapability(MobileCapabilityType.DeviceName, deviceID);
     capabilities.SetCapability("autoLaunch", false);
     capabilities.SetCapability(MobileCapabilityType.AppPackage, package);
     capabilities.SetCapability(MobileCapabilityType.AppActivity, activity);
     driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, TimeSpan.FromSeconds(60));
 }
開發者ID:cedarwy,項目名稱:AppuimTestTools,代碼行數:12,代碼來源:Android.cs

示例10: beforeAll

        public void beforeAll()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability("deviceName", "Google Nexus 6 - 5.0.0 - API 21 - 1400x2560");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("app", AppPath);

            _driver = new AndroidDriver<AppiumWebElement>(
                                                    new Uri(DeviceAddress),
                                                    capabilities);
        }
開發者ID:evolit,項目名稱:Appium.DotNet.TestingCommands,代碼行數:12,代碼來源:ProgramTest.cs

示例11: BeforeAll

		public void BeforeAll(){
			DesiredCapabilities capabilities = Env.isSauce () ? 
				Caps.getAndroid501Caps (Apps.get ("androidApiDemos")) :
				Caps.getAndroid19Caps (Apps.get ("androidApiDemos"));
			if (Env.isSauce ()) {
				capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME")); 
				capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
				capabilities.SetCapability("name", "android - simple");
				capabilities.SetCapability("tags", new string[]{"sample"});
			}
			Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;
            driver = new AndroidDriver<AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);	
			driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
		}
開發者ID:trbnb,項目名稱:appium-dotnet-driver,代碼行數:14,代碼來源:AndroidSearchingTest.cs

示例12: BeforeAll

 public void BeforeAll()
 {
     DesiredCapabilities capabilities = Env.isSauce () ?
         Caps.getAndroid18Caps (Apps.get ("selendroidTestApp")) :
         Caps.getAndroid19Caps (Apps.get ("selendroidTestApp"));
     if (Env.isSauce ()) {
         capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
         capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
         capabilities.SetCapability("name", "android - webview");
         capabilities.SetCapability("tags", new string[]{"sample"});
     }
     Uri serverUri = Env.isSauce () ? AppiumServers.sauceURI : AppiumServers.localURI;
     driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
     driver = new AndroidDriver<IWebElement>(capabilities);
 }
開發者ID:teddym6,項目名稱:appiumDotNet,代碼行數:15,代碼來源:AndroidWebviewTest.cs

示例13: BeforeAll

 public void BeforeAll()
 {
     DesiredCapabilities capabilities = Env.isSauce() ?
         Caps.getAndroid18Caps(Apps.get("selendroidTestApp")) :
         Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));
     if (Env.isSauce())
     {
         capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
         capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
         capabilities.SetCapability("tags", new string[] { "sample" });
     }
     Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;
     driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
     pageObject = new AndroidJavaScriptTestPageObject(driver);
     driver.StartActivity("io.selendroid.testapp", ".WebViewActivity");
 }
開發者ID:pver,項目名稱:appium-dotnet-driver,代碼行數:16,代碼來源:AndroidJSWebViewTest.cs

示例14: Inisialized

        public void Inisialized()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability("deviceName", "Nexus 5");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("app", @"C:\Users\Administrator\AppData\Roaming\Skype\My Skype Received Files\purevpn-release.apk");
            capabilities.SetCapability("platformVersion", "4.4");
            capabilities.SetCapability("appPackage", "com.gaditek.purevpnics");
            // capabilities.SetCapability("appPackage", "com.gaditek.purevpnics.main.SplashActivity");
            // capabilities.SetCapability("appActivity", "com.gaditek.purevpnics.main.MainActivity");
            capabilities.SetCapability("appActivity", "com.gaditek.purevpnics.main.AuthActivity");
            //   WebDriverWait wait = new WebDriverWait(driver, 10);

            driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:8082/wd/hub"), capabilities);
        }
開發者ID:gaditek,項目名稱:appium-test-obj-1,代碼行數:16,代碼來源:NUnitTest1.cs

示例15: BeforeAll

 public void BeforeAll()
 {
     DesiredCapabilities capabilities =
         Caps.getSelendroid16Caps(Apps.get("selendroidTestApp"));
     if (Env.isSauce())
     {
         capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
         capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
         capabilities.SetCapability("name", "android - complex");
         capabilities.SetCapability("tags", new string[] { "sample" });
     }
     Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;
     driver = new AndroidDriver<AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
     TimeOutDuration timeSpan = new TimeOutDuration(new TimeSpan(0, 0, 0, 5, 0));
     pageObject = new AndroidPageObjectChecksSelendroidModeOnNativeApp();
     PageFactory.InitElements(driver, pageObject, new AppiumPageObjectMemberDecorator(timeSpan));
 }
開發者ID:illyric,項目名稱:sample-code,代碼行數:17,代碼來源:AndroidTestThatChecksAttributeMix3SelendroidMode.cs


注:本文中的OpenQA.Selenium.Appium.Android.AndroidDriver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。