-
-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting implicit wait timeout when using PageFactory #203
Comments
@TikhomirovSergey any ideas? |
Hi! afd = new AppiumFieldDecorator(driver, 10, TimeUnit.SECONDS);
PageFactory.initElements(afd, this);
//some code
afd.resetImplicitlyWaitTimeOut(0, TimeUnit.SECONDS); @Simon-Kaz please let me know about the result. If you are still facing the problem please provide a gist with code sample that descrides your use case. ... Still interesting. Why do you need 0-timeout? |
@Simon-Kaz @Jonahss It seems some elements need a timeout that differs from the default. What if user would able to define it like that: @WithTimeout(timeOut = time, timeUnit = unit)
@FindBy("your locator")
WebElement e; //waits for the rendering. Duratin is time out that has been set via @WithTimeout
@FindBy("your another locator")
WebElement e2; //waits for the rendering. Duratin is time out that has been set by default
//e.g. PageFactory.initElements(new AppiumFieldDecorator(driver, 10, TimeUnit.SECONDS), this); ? I wish github had a voting for some project features. |
Sorry, just getting back to this now. My use case is that I need to set implicit wait to 0 to prevent unnecessary waiting if element is not found. I created a custom scrolling method (borrowed a lot from uiAutomator scrolling ;) ) that takes a webElement, as the scrollTo and scrollToExact only take strings, and uiAutomator only takes UiSelector. https://gist.github.com/Simon-Kaz/551b66e177c1063893b5 I check for visibility of element at the beginning, after scrollUpScreenLength , and after every scrollDownScreenLength. Now, if the implicit wait is set to, for example, 5 seconds, then every time I check if the element is visible, I will have to wait 5 seconds. I want to reset that timeout so that the isElementVisible takes as little time as possible. |
@Simon-Kaz afd = new AppiumFieldDecorator(driver, 10, TimeUnit.SECONDS);
PageFactory.initElements(afd, this);
//some code
afd.resetImplicitlyWaitTimeOut(0, TimeUnit.SECONDS); and what do you think about the idea above? |
I haven't tried that yet, I'll try this later today and report my findings ! :) I think the additional annotation for timeout could be very useful. For example:
|
The following:
driver.manage().timeouts().implicitlyWait(0);
Doesn't affect the implicit wait - i still have to wait the time specified in Page Factory.
And the following:
PageFactory.initElements(new AppiumFieldDecorator(driver, 0, TimeUnit.SECONDS), this);
Doesn't work - my app is still waiting the originally set timeout before confirming that the element has not been found. The original set timeout was 10 seconds and this is what I see in logs:
info: [debug] Set Android implicit wait to 10000ms
The text was updated successfully, but these errors were encountered: