コード例 #1
2
        public virtual void InitializeDriver()
        {
            InitializeSettings();

            switch (BrowserType)
            {
                case BrowserType.Chrome:
                    var chromeOptions = new ChromeOptions();
                    chromeOptions.AddArguments(new string[] { "--no-sandbox", "test-type", "--start-maximized" });
                    var chromeDriverService = ChromeDriverService.CreateDefaultService();
                    chromeDriverService.HideCommandPromptWindow = false;
                    Context.Driver = new ChromeDriver(chromeDriverService, chromeOptions, TimeSpan.FromSeconds(300.0));
                break;
                case BrowserType.Firefox:
                    var capabilities = new DesiredCapabilities();
                    capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "dismiss");
                    Context.Driver = new FirefoxDriver(capabilities);
                break;

            }

            Context.Browser = new Browser();
            Context.Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(Context.Settings.WaitTimeout));
            Context.Driver.Navigate().GoToUrl("about:blank");
            Context.Driver.SwitchTo().Window(Context.Driver.WindowHandles.First());
        }
コード例 #2
1
ファイル: Tests.cs プロジェクト: mneiferbag/testdroid-samples
		public void BeforeAll()
		{

			String TESTDROID_USERNAME = "******";
			String 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.");


		}
コード例 #3
1
ファイル: Caps.cs プロジェクト: FlawlessFalcon/sample-code
		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;
        }
コード例 #4
1
ファイル: Setup.cs プロジェクト: rovens/specflowdemo
        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;
        }
コード例 #5
1
		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;
		}
コード例 #6
1
 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);
 }
コード例 #7
1
        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();
                }
            }
        }
コード例 #8
0
        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://*****:*****@class=\"f\"]")).Click();
            Thread.Sleep(3000);
            driver.FindElement(By.XPath("//button[@id=\"searchlistsubmit88888888\"]")).Click();
            Thread.Sleep(3000);

            //driver.Quit();
        }
コード例 #9
0
ファイル: Caps.cs プロジェクト: trbnb/appium-dotnet-driver
		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;
		}
コード例 #10
0
 /// <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;
 }
コード例 #11
0
 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);
 }
コード例 #12
0
ファイル: Caps.cs プロジェクト: illyric/sample-code
		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;
		}
コード例 #13
0
ファイル: GridProject.cs プロジェクト: Vishwa1/SeleniumGrid
 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);
 }
コード例 #14
0
ファイル: Session.cs プロジェクト: c444b774/JSIL
        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;
            }
        }
コード例 #15
0
 /// <summary>
 /// Configure desktop browser
 /// </summary>
 public CommonBrowserStackBrowserFactory(string browser, string browserVersion, string os, string osVersion, string resolution)
 {
     var caps = new DesiredCapabilities();
     caps.SetCapability(DesiredCapsBrowserKey, browser);
     caps.SetCapability(DesiredCapsBrowserVersionKey, browserVersion);
     caps.SetCapability(DesiredCapsOperatingSystemKey, os);
     caps.SetCapability(DesiredCapsOperationSystemVersionKey, osVersion);
     caps.SetCapability(DesiredCapsResolutionKey, resolution);
     commonCaps = caps;
 }
コード例 #16
0
 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);
 }
コード例 #17
0
ファイル: Driver.cs プロジェクト: nobowned/AppiumTest
 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);
 }
コード例 #18
0
ファイル: Driver.cs プロジェクト: nobowned/AppiumTest
 public TestClass()
 {
     DesiredCapabilities capabilities = new DesiredCapabilities();
     capabilities.SetCapability("appium-version", "1.0");
     capabilities.SetCapability("platformName", "Android");
     capabilities.SetCapability("platformVersion", "4.2.1");
     capabilities.SetCapability("deviceName", "");
     capabilities.SetCapability("app", "/Users/i51375/Code/calabash.mobile/apk/XM8Mobile_1.2.382.e2f2aa0.apk");
     driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
 }
コード例 #19
0
        public void beforeAll()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

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

            driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wh/hub"), capabilities);
        }
コード例 #20
0
        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();
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        public void Test2()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability("device", "Android");
            capabilities.SetCapability("app", "Chrome");
            capabilities.SetCapability(CapabilityType.BrowserName, "Browser");
            capabilities.SetCapability(CapabilityType.Version, "4.3");
            capabilities.SetCapability(CapabilityType.Platform, "WINDOWS");
            IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
            driver.Navigate().GoToUrl("http://www.espn.com") ;

        }
コード例 #23
0
ファイル: GivenITGuys.cs プロジェクト: sllabres/sllabres
 public void SetUp()
 {
     var configuration = new SessionConfiguration { Driver = typeof(SauceLabsDriver) };
     var desiredCapabilites = new DesiredCapabilities("chrome", "46", Platform.CurrentPlatform);
     desiredCapabilites.SetCapability("platform", "Windows 7");
     desiredCapabilites.SetCapability("username", "sebllabres");
     desiredCapabilites.SetCapability("accessKey", "892fdc2f-7409-4979-a592-e5e3d3ee73bc");
     desiredCapabilites.SetCapability("name", TestContext.CurrentContext.Test.Name);
     _driver = new SauceLabsDriver(Browser.Parse(ConfigurationSettings.AppSettings["browser"]), desiredCapabilites, new CustomRemoteDriver(new Uri("http://ondemand.saucelabs.com:80/wd/hub"), desiredCapabilites));
     _browserSession = new BrowserSession(configuration, _driver);
     _browserSession.MaximiseWindow();
 }
コード例 #24
0
        public static void Initialize()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability("deviceName", "Zeta Reticuli");
            capabilities.SetCapability("platformName", "Android");
            capabilities.SetCapability("platformVersion", "5.1.1");
            capabilities.SetCapability("appPackage", "ae.propertyfinder.propertyfinder");
            capabilities.SetCapability("appActivity", "ae.propertyfinder.MainActivity");

            Driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities,
                TimeSpan.FromSeconds(30));
            Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(4));
        }
コード例 #25
0
ファイル: Grid.cs プロジェクト: nat-github/Selenium-projec
 public void setup()
 {
     
     //string test;
     //System.Environment.SetEnvironmentVariable("webdriver.ie.driver", @"C:\Selenium_Lib\IEDriverServer_Win32_2.48.0\IEDriverServer.exe");
     DesiredCapabilities cap = new DesiredCapabilities();
     cap = DesiredCapabilities.InternetExplorer();
     cap.SetCapability(CapabilityType.BrowserName, "internet explorer");
     //test = Environment.GetEnvironmentVariable("webdriver.ie.driver");
     //Console.WriteLine(test);
     cap.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Windows));
     driver = new RemoteWebDriver(new Uri("http://192.168.1.34:4444/wd/hub"), cap);
 }
コード例 #26
0
        public void Init()
        {
            testParams = PNUnitServices.Get().GetTestParams();
            String params1 = String.Join(",", testParams);
            Console.WriteLine(params1);
            String browser = testParams[0];
            String version = testParams[1];
            String os = testParams[2];
            String os_version = testParams[3];
            String platform = testParams[4];
            String device = testParams[5];
            DesiredCapabilities capability = new DesiredCapabilities();
            capability.SetCapability("browserName", browser);
            capability.SetCapability(CapabilityType.Version, version);
            capability.SetCapability("os", os);
            capability.SetCapability("os_version", os_version);
            capability.SetCapability("platform", platform);
            capability.SetCapability("device", device);
            capability.SetCapability("browserstack.user", "<USERNAME>");
            capability.SetCapability("browserstack.key", "<ACCESS_KEY>");

            Console.WriteLine("Capabilities" + capability.ToString());

            driver = new RemoteWebDriver(new Uri("http://hub.browserstack.com:80/wd/hub/"), capability);
        }
コード例 #27
0
        public void Init()
        {
            DesiredCapabilities caps = new DesiredCapabilities();
            caps.SetCapability(CapabilityType.BrowserName, browser);
            //caps.SetCapability(CapabilityType.Version, version);
            //   caps.SetCapability(CapabilityType.Platform, os);
            //  caps.SetCapability("deviceName", deviceName);
            //  caps.SetCapability("deviceOrientation", deviceOrientation);
            //  caps.SetCapability("username", Constants.SAUCE_LABS_ACCOUNT_NAME);
            //  caps.SetCapability("accessKey", Constants.SAUCE_LABS_ACCOUNT_KEY);
            caps.SetCapability("name", TestContext.CurrentContext.Test.Name);

            driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), caps, TimeSpan.FromSeconds(600));

        }
コード例 #28
0
        public void beforeAll()
        {
            // find the test application

            // set up the remote web driver
            Console.WriteLine("Connecting to Appium server");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            //capabilities.SetCapability("appium-version", "1.0");

            //capabilities.SetCapability("platformVersion", "7.1");
            capabilities.SetCapability("deviceName", "iPhone Simulator");
            capabilities.SetCapability("platformName", "iOS");
            capabilities.SetCapability("browserName","safari");

            driver = new RemoteWebDriver(new Uri("http://172.16.144.8:4723/wd/hub"), capabilities);
        }
コード例 #29
0
        public void when_logging_in_with_an_invalid_username_and_password()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);

            try
            {
                driver.Navigate().GoToUrl("http://*****:*****@user.com");
                driver.FindElement(By.Name("Password")).SendKeys("BadPass");
                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual("http://localhost:52125/Account/LogOn");

                driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
                    "The user name or password provided is incorrect.");
            }
            finally
            {
                driver.Close();
            }
        }
コード例 #30
0
        /// <summary>
        /// 模拟器通过Appium跑H5用例----> 有问题 
        /// </summary>
        public void TestH5Appium()
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();
            //capabilities.SetCapability("appium-version", "1.0");
            capabilities.SetCapability("deviceName", "android");
            capabilities.SetCapability("udid", "EAZSRK6HIJHEAYSK");
            capabilities.SetCapability("BrowserName","UC Browser");
            driver = new AppiumDriver(new Uri("http://localhost:4723/wd/hub"), capabilities);

            driver.Navigate().GoToUrl("http://www.baidu.com");
            Thread.Sleep(7000);

            CommonFunction comFun = new CommonFunction();
            comFun.ITakesScreenshots(driver);
            driver.Quit();
        }