public void RunBeforeEach()
 {
     server.respondToInit ();
     DesiredCapabilities capabilities = new DesiredCapabilities();
     driver = new AppiumDriver (new Uri("http://127.0.0.1:4724/wd/hub"), capabilities);
     server.clear ();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MultiTouchActions"/> class.
        /// </summary>
        /// <param name="driver">The <see cref="IWebDriver"/> object on which the actions built will be performed.</param>
        public MultiTouchAction(AppiumDriver driver)
        {
            if (driver == null)
            {
                throw new ArgumentException("The IWebDriver object must implement or wrap a driver that implements IHasTouchScreen.", "driver");
            }

            this._Driver = driver;
        }
Example #3
0
 public CalculatorTests(TestFixture fixture)
 {
     driver = fixture.driver;
     calc   = new CalculatorPO(driver);
 }
        public WindowsAlarmApp(AppiumDriver <AppiumWebElement> driver, TimeOutDuration timeout)
        {
            _driver = driver;

            PageFactory.InitElements(driver, this, new AppiumPageObjectMemberDecorator(timeout));
        }
Example #5
0
 public static void CleanUp()
 {
     _driver.Quit();
     _driver.Dispose();
     _driver = null;
 }
Example #6
0
 /// <summary>
 /// Get the wait default wait driver
 /// </summary>
 /// <param name="driver">Brings in an AppiumDriver</param>
 /// <param name="timeoutTime">How long is the timeout</param>
 /// <param name="waitTime">How long to wait before rechecking</param>
 /// <returns>A web driver wait</returns>
 public static WebDriverWait GetWaitDriver(AppiumDriver <IWebElement> driver, TimeSpan timeoutTime, TimeSpan waitTime)
 {
     return(new WebDriverWait(new SystemClock(), driver, timeoutTime, waitTime));
 }
 /// <summary>
 /// Cancels the Touch Action
 /// </summary>
 public void Cancel()
 {
     this.driver = null;
     steps.Clear();
 }
 public TwitterMobilePageFactory(AppiumDriver <AppiumWebElement> driver)
 {
     Driver = driver;
 }
Example #9
0
 public IReadOnlyCollection <AndroidElement> GetElements(AppiumDriver <AndroidElement> driver, string elementName)
 {
     return(base.GetElements(driver, _screenName, elementName));
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiTouchAction"/> class.
 /// </summary>
 /// <param name="driver">The <see cref="IWebDriver"/> the driver to be used.</param>
 public MultiAction(AppiumDriver driver)
 {
     this.driver = driver;
 }
Example #11
0
 public void WriteTextToField(AppiumDriver <AndroidElement> driver, string text, string field)
 {
     base.WriteTextToField(driver, _screenName, text, field);
 }
Example #12
0
 public AndroidElement GetElement(AppiumDriver <AndroidElement> driver, string elementName)
 {
     return(base.GetElement(driver, _screenName, elementName));
 }
Example #13
0
 public void ClickElement(AppiumDriver <AndroidElement> driver, string elementName)
 {
     base.ClickElement(driver, _screenName, elementName);
 }
 /// <summary>
 /// Bring element in Focus
 /// </summary>
 /// <param name="driver">Driver</param>
 /// <param name="element">Element to bring to focus</param>
 public static void MoveTo(this AppiumDriver <AppiumWebElement> driver, AppiumWebElement element)
 {
     MoveTo(driver, element, 0, 0);
 }
Example #15
0
 /// <summary>
 /// Override the driver
 /// This allows you to use something other than the default tests object driver.
 /// </summary>
 /// <param name="appiumDriver">The override driver</param>
 public void OverrideDriver(AppiumDriver <IWebElement> appiumDriver)
 {
     this.AppiumDriver = appiumDriver;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteTouchScreen"/> class.
 /// </summary>
 /// <param name="driver">The <see cref="RemoteWebDriver"/> for which the touch screen will be managed.</param>
 public RemoteMultiTouchScreen(AppiumDriver driver)
     : base(driver)
 {
     _Driver = driver;
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LazyMobileElement" /> class
 /// </summary>
 /// <param name="testObject">The base Appium test object</param>
 /// <param name="appiumDriver">The Appium driver</param>
 /// <param name="locator">The 'by' selector for the element</param>
 /// <param name="userFriendlyName">A user friendly name, for logging purposes</param>
 public LazyMobileElement(AppiumTestObject testObject, AppiumDriver <IWebElement> appiumDriver, By locator, [CallerMemberName] string userFriendlyName = null) : base(testObject, appiumDriver, () => appiumDriver.GetWaitDriver(), locator, userFriendlyName)
 {
 }
Example #18
0
 public SpeedPage(AppiumDriver <AndroidElement> driver)
 {
     _driver = driver;
 }
 public TouchAction(AppiumDriver driver)
 {
     this.driver = driver;
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AppiumTestObject" /> class
 /// </summary>
 /// <param name="appiumDriver">The test's Appium driver</param>
 /// <param name="logger">The test's logger</param>
 /// <param name="fullyQualifiedTestName">The test's fully qualified test name</param>
 public AppiumTestObject(AppiumDriver <IWebElement> appiumDriver, Logger logger, string fullyQualifiedTestName) : base(logger, fullyQualifiedTestName)
 {
     this.ManagerStore.Add(typeof(MobileDriverManager).FullName, new MobileDriverManager(() => appiumDriver, this));
     this.SoftAssert = new AppiumSoftAssert(this);
 }
 /// <summary>
 /// Cancels the Touch Action
 /// </summary>
 public void Cancel()
 {
     this.driver = null;
     steps.Clear ();
 }
 public TouchAction(AppiumDriver driver)
 {
     this.driver = driver;
 }
Example #23
0
 public IdeasModel(AppiumDriver <IWebElement> driver, ExtentTest test)
     : base(driver, test)
 {
 }
 public StepsToMenuOptions(AppiumDriver <IWebElement> driver)
 {
     this.driver = driver;
 }
Example #25
0
 public TimePicker(AppiumDriver <AndroidElement> driver)
 {
     this.driver = driver;
 }
Example #26
0
 /// <summary>
 /// Get the wait default wait driver
 /// </summary>
 /// <param name="driver">Brings in an AppiumDriver</param>
 /// <returns>An WebDriverWait</returns>
 public static WebDriverWait GetDefaultWaitDriver(AppiumDriver <IWebElement> driver)
 {
     return(GetWaitDriver(driver, AppiumConfig.GetMobileTimeout(), AppiumConfig.GetMobileWaitTime()));
 }
Example #27
0
        public void CreateAppiumDriver(string deviceName)
        {
            MobileDriverFactory mobileDriverFactory = new MobileDriverFactory();

            AppiumDriver = mobileDriverFactory.CreateDriver(deviceName);
        }
Example #28
0
 public PageActions()
 {
     pageDriver = BaseClass.AppDriver;
 }
 public EulaScreen(AppiumDriver <IWebElement> driver) : base(driver)
 {
 }
Example #30
0
        /// <summary>
        /// Create a TestBase for your specific project (see TestBaseStarAppIos, for example) and call this method.
        /// The Setup annotation was removed to prevent it being called when there is a project specific Setup (see above).
        /// </summary>
        public static void Setup()
        {
            // Log Before Action
            Log.BeforeAction();

            // Perform the action
            try
            {
                // Create a variable to serve as a flag for if a new session needs to be created or not
                bool createNewSession = false;
                // Create a variable to hold the Test's WebDriver
                AppiumDriver <AppiumWebElement> driver = null;
                // Is the global WebDriver varaiable set?
                if (Session.driver != null)
                {
                    // Create a variable to hold the Session Info
                    Dictionary <string, object> sessionInfo = null;
                    // Try to get the Session Info (which only works if there is a valid session) from the global variable
                    // Note: We need to use the same Appium session (driver) for all test or we could lose the device in the cloud.
                    try { sessionInfo = Session.driver.SessionDetails; }
                    catch { /* do nothing */ }
                    // Check the Session Info variable has some content
                    if (sessionInfo != null)
                    {
                        // Use the existing session
                        Log.WriteLine("    [INFO] Using the existing session.");
                        driver = Session.driver;
                    }
                    else
                    {
                        // Set the flag to create a new session to true
                        createNewSession = true;
                    }
                }
                // Should we create a new session?
                if (createNewSession == true)
                {
                    // Wait 60 seconds to timeout any existing sessions (in SauceLab's TestObject)
                    if (ConfigurationManager.AppSettings["appConfig"].ToString().Contains("SauceLabs"))
                    {
                        Sleep.Milliseconds(60000, "Waiting 60 seconds to kill the current session (in SauceLab's TestObject).");
                    }
                    // Create a new session
                    Log.WriteLine("    [INFO] Creating a new session.");
                    driver = Session.Create();
                }
                // Save a reference to the current Test's driver (session) in its TestContext
                TestContext.Set("driver", driver);

                // Reset the app
                AppBase.ResetApp();

                // Logging - After action success
                Log.Success();
            }
            catch (Exception e)
            {
                // Logging - After action exception
                Log.Failure(e.Message);
                // Fail current test
                Assert.Fail(e.Message);
            }
            finally
            {
                // Logging - After action
                Log.Finally();
            }
        }
 public void RunBeforeAll()
 {
     server = new FakeAppium (4753);
     server.Start ();
     server.respondToInit ();
     DesiredCapabilities capabilities = new DesiredCapabilities();
     driver = new AppiumDriver (new Uri("http://127.0.0.1:4753/wd/hub"), capabilities);
     server.clear ();
 }
 public AreaPage(AppiumDriver <AndroidElement> driver)
 {
     _driver = driver;
 }
Example #33
0
 /// <summary>
 /// Sets the driver.
 /// </summary>
 /// <param name="driver">The <see cref="IWebDriver"/> the driver to be used.</param>
 public void setDriver(AppiumDriver driver)
 {
     this.driver = driver;
 }
Example #34
0
 public AnimalPage(AppiumDriver <AppiumWebElement> driver) : base(driver)
 {
 }
Example #35
0
 /// <summary>
 /// Override the Appium driver
 /// </summary>
 /// <param name="appiumDriver">New Appium driver</param>
 public void OverrideWebDriver(AppiumDriver <IWebElement> appiumDriver)
 {
     this.AppiumManager.OverrideDriver(appiumDriver);
 }
 /// <summary>
 /// Initializes a new instance of the AndroidElement class.
 /// </summary>
 /// <param name="parent">Driver in use.</param>
 /// <param name="id">ID of the element.</param>
 public AndroidElement(AppiumDriver parent, string id)
     : base(parent, id)
 {
 }
 public LoginPage(AppiumDriver <AndroidElement> driver) => this.driver = driver;
Example #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultiTouchAction"/> class.
 /// </summary>
 /// <param name="driver">The <see cref="IWebDriver"/> the driver to be used.</param>
 /// <param name="element">The <see cref="IWebDriver"/> the element on which the actions built will be performed.</param>
 public MultiAction(AppiumDriver driver, IWebElement element)
 {
     this.driver = driver;
     this.element = element;
 }
 /// <summary>
 /// Set wait driver
 /// </summary>
 /// <param name="driver">The appium driver</param>
 /// <param name="waiter">Web Driver Wait</param>
 public static void SetWaitDriver(this AppiumDriver <IWebElement> driver, WebDriverWait waiter)
 {
     waitCollection.AddOrUpdate(driver, waiter, (oldkey, oldvalue) => waiter);
 }
Example #40
0
 /// <summary>
 /// Cancels the Multi Action
 /// </summary>
 public void Cancel()
 {
     this.driver = null;
     this.element = null;
     actions.Clear ();
 }
 /// <summary>
 /// Remove the stored wait driver
 /// </summary>
 /// <param name="driver">The appium driver</param>
 /// <returns>True if the wait driver was removed</returns>
 public static bool RemoveWaitDriver(this AppiumDriver <IWebElement> driver)
 {
     return(waitCollection.TryRemove(driver, out WebDriverWait temp));
 }