Skip to content

[WithTimeSpan(Second = ...)] attribute ignored #205

@agriardyan

Description

@agriardyan

Description

I'm trying to implement page object on certain project. I'm very keen on Java, and there is no issue when using @WithTimeout annotation to wait either until element present or timeout. Just migrating to C#, I found that the equivalent @WithTimeout annotation is [WithTimeSpan] attribute, which I implement then I notice it's do nothing. Since I can't perform wait with that, Appium keep telling me no such element. I've adjust seconds up to 50 seconds, and even minutes (although on manual test, it should only wait for less than 10 seconds).

Environment

  • .NET : 4.5.2
  • Appium server version : 1.6.5 on Appium Desktop 1.2.2
  • Desktop OS/version used to run Appium if necessary: Windows 10 Professional
  • Mobile platform/version under test: Android 4.4 (Kitkat), Android 5.0 (Lolipop) and Android 7 (Nougat)
  • Real device: Lenovo K5
  • Emulator: Google Emulator

Details

I implement it such as below. This class called from unit test. And yes, I have satisfy all capabilities.

using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Interfaces;
using OpenQA.Selenium.Appium.PageObjects.Attributes;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace AppiumTraining.page
{
    class AltusLoginPage
    {
        private AppiumDriver<AppiumWebElement> driver;
        
        public AltusLoginPage(AppiumDriver<AppiumWebElement> driver)
        {
            this.driver = driver;
            PageFactory.InitElements(driver, this);
        }

        [WithTimeSpan(Seconds = 30)]
        [FindsBy(How = How.XPath, Using = "//*[@id='Input_UsernameVal2']")]        
        private IWebElement customerCodeField;

        public void doSomething()
        {
            customerCodeField.Clear();
            customerCodeField.SendKeys("Altus");
        }
    }
}

Link to Appium logs

I don't think logs are related to this issue, but here is it.
https://gist.github.com/agriardyan/a2159ab6aff422b520fc85df63b78d2f

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions