当前位置: 首页>>代码示例>>C#>>正文


C# DesiredCapabilities.SetCapability方法代码示例

本文整理汇总了C#中OpenQA.Selenium.Remote.DesiredCapabilities.SetCapability方法的典型用法代码示例。如果您正苦于以下问题:C# DesiredCapabilities.SetCapability方法的具体用法?C# DesiredCapabilities.SetCapability怎么用?C# DesiredCapabilities.SetCapability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenQA.Selenium.Remote.DesiredCapabilities的用法示例。


在下文中一共展示了DesiredCapabilities.SetCapability方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeforeAll

		public void BeforeAll()
		{

			String TESTDROID_USERNAME = "Testdroid username";
			String TESTDROID_PASSWORD = "Testdroid Password";

			DesiredCapabilities capabilities = new DesiredCapabilities();
			capabilities.SetCapability("device", "Android");

			capabilities.SetCapability("deviceName", "Android");
			capabilities.SetCapability("platformName", "Android");


			capabilities.SetCapability("testdroid_username", TESTDROID_USERNAME);
			capabilities.SetCapability("testdroid_password", TESTDROID_PASSWORD);
			capabilities.SetCapability("testdroid_target", "Android");
			capabilities.SetCapability("testdroid_project", "C# Appium");
			capabilities.SetCapability("testdroid_testrun", "Android Run 1");

			// See available devices at: https://cloud.testdroid.com/#public/devices
			capabilities.SetCapability("testdroid_device", "Dell Venue 7 3730"); // Freemium device
			capabilities.SetCapability("testdroid_app", "sample/BitbarSampleApp.apk"); //to use existing app using "latest" as fileUUID

			Console.WriteLine ("WebDriver request initiated. Waiting for response, this typically takes 2-3 mins");
			driver = new AndroidDriver<AndroidElement>(new Uri("http://appium.testdroid.com/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
			Console.WriteLine ("WebDriver response received.");


		}
开发者ID:mneiferbag,项目名称:testdroid-samples,代码行数:29,代码来源:Tests.cs

示例2: getIos82Caps

		public static DesiredCapabilities getIos82Caps (string app) {
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "8.2");
            capabilities.SetCapability(MobileCapabilityType.DeviceName, "iPhone Simulator");
            capabilities.SetCapability(MobileCapabilityType.App, app);
            return capabilities;
        }
开发者ID:FlawlessFalcon,项目名称:sample-code,代码行数:7,代码来源:Caps.cs

示例3: BeforeScenario

        public void BeforeScenario()
        {
            if (string.IsNullOrEmpty(_settings.Browser))
            {
                driver = new OpenQA.Selenium.PhantomJS.PhantomJSDriver();
            }
            else
            {
             //driver = new OpenQA.Selenium.PhantomJS.PhantomJSDriver();
             var capabilities = new DesiredCapabilities();
              // construct the url to sauce labs
              Uri commandExecutorUri = new Uri("http://ondemand.saucelabs.com/wd/hub");
                capabilities.SetCapability("username", _settings.Username); // supply sauce labs username
                capabilities.SetCapability("accessKey", _settings.ApiKey);
                // supply sauce labs account key
                capabilities.SetCapability("name", TestContext.CurrentContext.Test.Name); // give the test a name
                capabilities.SetCapability("timeZone", "Queensland");
                capabilities.SetCapability("browserName", _settings.Browser); // "Chrome");
                capabilities.SetCapability("platform", _settings.Platform); // "Windows 10");
                capabilities.SetCapability("version", _settings.Version);
                capabilities.SetCapability("build",
                    GetType().Assembly.GetName().Name + "_" +
                    Environment.GetEnvironmentVariable("SAUCELABS_BUILD_NUMBER"));
                capabilities.SetCapability("name", ScenarioContext.Current.ScenarioInfo.Title);

                // start a new remote web driver session on sauce labs
                driver = new SessionAwareRemoteDriver(commandExecutorUri, capabilities);

            }

            //     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
            ScenarioContext.Current["driver"] = driver;
        }
开发者ID:rovens,项目名称:specflowdemo,代码行数:34,代码来源:Setup.cs

示例4: BeforeScenario

		public void BeforeScenario()
		{
			if (Process.GetProcessesByName("BrowserStackLocal").Length == 0)
				new Process
				{
					StartInfo = new ProcessStartInfo
					{
						FileName = "BrowserStackLocal.exe",
						Arguments = ConfigurationManager.AppSettings["browserstack.key"] + " -forcelocal"
					}
				}.Start();


			var capabilities = new DesiredCapabilities();

			capabilities.SetCapability(CapabilityType.Version, ConfigurationManager.AppSettings["version"]);
			capabilities.SetCapability("os", ConfigurationManager.AppSettings["os"]);
			capabilities.SetCapability("os_version", ConfigurationManager.AppSettings["os_version"]);
			capabilities.SetCapability("browserName", ConfigurationManager.AppSettings["browser"]);
			
			capabilities.SetCapability("browserstack.user", ConfigurationManager.AppSettings["browserstack.user"]);
			capabilities.SetCapability("browserstack.key", ConfigurationManager.AppSettings["browserstack.key"]);
			capabilities.SetCapability("browserstack.local", true);
			
			capabilities.SetCapability("project", "BrowserStack Demo");
			capabilities.SetCapability("name", ScenarioContext.Current.ScenarioInfo.Title);

			driver = new RemoteWebDriver(new Uri(ConfigurationManager.AppSettings["browserstack.hub"]), capabilities);
			driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
			ScenarioContext.Current["driver"] = driver;
		}
开发者ID:AndreaChG,项目名称:SpecFlow.BrowserStack,代码行数:31,代码来源:Setup.cs

示例5: SetUp

 public void SetUp()
 {
     DesiredCapabilities Capabilities = new DesiredCapabilities();
     Capabilities.SetCapability(CapabilityType.BrowserName, "firefox");
     string GridURL = "http://localhost:4444/wd/hub";
     Driver = new RemoteWebDriver(new Uri(GridURL), Capabilities);
 }
开发者ID:GruLab,项目名称:elemental-selenium-tips,代码行数:7,代码来源:Grid.cs

示例6: 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

示例7: TestChromeBrowser

        public void TestChromeBrowser()
        {
            //string appPath = @"D:\git-zjs\Appium-Test-ios-android\AppiumDriverDemo\Apps\UCBrowser_V9.8.0.435_Android_pf145_(Build14052717).apk";
            string appPath = @"D:\git-zjs\Appium-Test-ios-android\AppiumDriverDemo\Apps\chrome.apk";
            DesiredCapabilities cap = new DesiredCapabilities();
            //cap.SetCapability("appium-version", "1.0");
            cap.SetCapability(CapabilityType.BrowserName, "");
            cap.SetCapability("platformName", "Android");
            cap.SetCapability("browserName", "chrome");
            cap.SetCapability("udid", "EAZSRK6HIJHEAYSK");  //三星手机 //4d00627749d2a037    红米手机 //EAZSRK6HIJHEAYSK   小米3 //bba1bd7
            cap.SetCapability("app", appPath);

            //UC Browser设置
            //cap.SetCapability("app-package", "com.UCMobile");
            //cap.SetCapability("app-activity", "com.uc.browser.InnerUCMobile");

            //Chrome设置
            //cap.SetCapability("app-package", "com.android.chrome");
            //cap.SetCapability("app-activity", "com.google.android.apps.chrome.Main");

            driver = new AppiumDriver(new Uri("http://localhost:4723/wd/hub"), cap);

            Thread.Sleep(3000);
            driver.Navigate().GoToUrl("http://m.ctrip.com");
            Thread.Sleep(3000);
            driver.FindElement(By.XPath("//li[@class=\"f\"]")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.XPath("//button[@id=\"searchlistsubmit88888888\"]")).Click();
            Thread.Sleep(3000);

            //driver.Quit();
        }
开发者ID:Bug2014,项目名称:Appium-Test-ios-android,代码行数:32,代码来源:ChromeTest.cs

示例8: getAndroid19Caps

		public static DesiredCapabilities getAndroid19Caps (string app) {
			DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(CapabilityType.BrowserName, "");
            capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "4.4.2");
            capabilities.SetCapability(MobileCapabilityType.DeviceName, "Android Emulator");
            capabilities.SetCapability(MobileCapabilityType.App, app);
			return capabilities;
		}
开发者ID:trbnb,项目名称:appium-dotnet-driver,代码行数:8,代码来源:Caps.cs

示例9: CommonBrowserStackBrowserFactory

 /// <summary>
 /// Configure mobile device browser
 /// </summary>
 public CommonBrowserStackBrowserFactory(string browserName, string platform, string device)
 {
     var caps = new DesiredCapabilities();
     caps.SetCapability(DesiredCapsBrowserKey, browserName);
     caps.SetCapability(DesiredCapsMobilePlatformKey, platform);
     caps.SetCapability(DesiredCapsMobileDeviceKey, device);
     commonCaps = caps;
 }
开发者ID:riganti,项目名称:selenium-utils,代码行数:11,代码来源:CommonBrowserStackBrowserFactory.cs

示例10: beforeAll

 public void beforeAll()
 {
     string appPath = @"D:\git-zjs\Appium-Test-ios-android\AppiumDriverDemo\Apps\ctrip_9013.apk";
     DesiredCapabilities cap = new DesiredCapabilities();
     cap.SetCapability("udid", "EAZSRK6HIJHEAYSK");    // 真机
     cap.SetCapability("app", appPath);
     driver = new AppiumDriver(new Uri("http://localhost:4728/wd/hub"), cap);
     Thread.Sleep(35000);
 }
开发者ID:Bug2014,项目名称:Appium-Test-ios-android,代码行数:9,代码来源:AppTests.cs

示例11: getIos71Caps

		public static DesiredCapabilities getIos71Caps (string app) {
			DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(CapabilityType.BrowserName, "");
			capabilities.SetCapability(MobileCapabilityType.AppiumVersion, "1.0");
			capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "7.1");
			capabilities.SetCapability(MobileCapabilityType.DeviceName, "iPhone Simulator");
			capabilities.SetCapability(MobileCapabilityType.App, app);
			return capabilities;
		}
开发者ID:illyric,项目名称:sample-code,代码行数:9,代码来源:Caps.cs

示例12: TestSetUp

 public void TestSetUp()
 {
     //driver = new FirefoxDriver();
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities = DesiredCapabilities.Firefox();
     capabilities.SetCapability(CapabilityType.BrowserName, "firefox");
     capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));
     driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);
 }
开发者ID:Vishwa1,项目名称:SeleniumGrid,代码行数:9,代码来源:GridProject.cs

示例13: Session

        public Session(string testName, bool runAgainstLocalServer = false)
        {
            try {
                RunningAgainstLocalServer = runAgainstLocalServer;

                TempPath = Path.GetTempPath();
                LogPath = Path.Combine(TempPath, "sauce_connect.log");

                DriverCapabilities = DesiredCapabilities.Chrome();
                DriverCapabilities.SetCapability(
                    CapabilityType.Platform, new Platform(PlatformType.Vista)
                );
                DriverCapabilities.SetCapability(
                    "name", testName
                );
                DriverCapabilities.SetCapability(
                    "username", SauceLabs.Credentials.username
                );
                DriverCapabilities.SetCapability(
                    "accessKey", SauceLabs.Credentials.accessKey
                );

                if (runAgainstLocalServer)
                    Proxy = StartProxy();
                else
                    Proxy = null;

                Console.Write("Starting browser... ");

                try {
                    WebDriver = new RemoteWebDriver(
                        new Uri("http://ondemand.saucelabs.com:80/wd/hub"),
                        DriverCapabilities
                    );

                    Console.WriteLine("started.");
                } catch (Exception exc) {
                    Console.WriteLine("failed.");
                    throw;
                }

                // Sauce doesn't support this :|
                /*
                WebDriver.Manage().Timeouts().SetPageLoadTimeout(
                    TimeSpan.FromSeconds(5)
                );
                WebDriver.Manage().Timeouts().SetScriptTimeout(
                    TimeSpan.FromSeconds(1)
                );
                 */

            } catch (Exception exc2) {
                Dispose();
                throw;
            }
        }
开发者ID:c444b774,项目名称:JSIL,代码行数:56,代码来源:Session.cs

示例14: 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

示例15: TestClass

 public TestClass()
 {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities.SetCapability("appium-version", "1.0");
     capabilities.SetCapability("platformName", "iOS");
     capabilities.SetCapability("platformVersion", "7.1");
     capabilities.SetCapability("deviceName", "iPhone Simulator");
     capabilities.SetCapability("app", "/Users/i51375/Code/xactimate.ios/Xactimate.iOS/bin/Debug/XactimateiOS.app");
     driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
 }
开发者ID:nobowned,项目名称:AppiumTest,代码行数:10,代码来源:Driver.cs


注:本文中的OpenQA.Selenium.Remote.DesiredCapabilities.SetCapability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。