Ejemplo n.º 1
0
        public object Decorate(MemberInfo member, IElementLocator locator)
        {
            var customizedResult = new DefaultPageObjectMemberDecorator().Decorate(member, locator);

            if (customizedResult != null)
            {
                return(customizedResult);
            }

            var property = member as PropertyInfo;

            if (property == null || !property.CanWrite || !property.GetMethod.IsPublic)
            {
                return(null);
            }

            var bys = new List <By>
            {
                By.Id(member.Name),
                new OrbitButtonLocator(member.Name),
                new OrbitTableFieldLocator(member.Name)
            };

            bool cache = ShouldCacheLookup(member);

            return(CreateProxyObject(property.PropertyType, locator, bys, cache));
        }
Ejemplo n.º 2
0
        public HomePage(IWebDriver driver)
        {
            RetryingElementLocator     retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(30));
            IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator();

            PageFactory.InitElements(retry.SearchContext, Driver, decor);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// <para> Implementation of Page Object Model </para>
        /// <para> PageFactory is a support class for the Selenium 2 Page Objects pattern </para>
        /// <para> RetryingElementLocator class used with the PageFactory which retries locating the element up to a timeout </para>
        /// Initializes all the page elements present in the DOM structure.
        ///
        /// </summary>
        protected PageBase()
        {
            var retry = new RetryingElementLocator(Driver, TimeSpan.FromSeconds(10));
            IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator();

            PageFactory.InitElements(retry.SearchContext, this, decor);
            //PageFactory.InitElements(Driver, this);
        }
Ejemplo n.º 4
0
        public PageObject(IWebDriver driver)
        {
            this.driver = driver;

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            RetryingElementLocator     retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(15));
            IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator();

            PageFactory.InitElements(retry.SearchContext, this, decor);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates an instance of the Page Factory base class with re-trying locators.
        /// </summary>
        /// <param name="driver">The current WebDriver instance.</param>
        protected PageFactoryBase(IWebDriver driver)
        {
            Driver = driver;
            var timeout = TimeSpan.FromSeconds(DefaultWaitTimeout);

            Wait = new WebDriverWait(driver, timeout);

            var locator   = new RetryingElementLocator(driver, timeout);
            var decorator = new DefaultPageObjectMemberDecorator();

            PageFactory.InitElements(this, locator, decorator);
        }
Ejemplo n.º 6
0
 public new static bool ShouldCacheLookup(MemberInfo member) => DefaultPageObjectMemberDecorator.ShouldCacheLookup(member);
Ejemplo n.º 7
0
 public new static ReadOnlyCollection <By> CreateLocatorList(MemberInfo member) => DefaultPageObjectMemberDecorator.CreateLocatorList(member);