Skip to content

page object pattern, field with "@WithTimeout" would change the global implicit wait time #467

Closed
@truebit

Description

@truebit

Description

page object pattern, field with "@WithTimeout" would change the global implicit wait time

Environment

Always exists. see code analysis below

Details

in method AppiumElementLocatorFactory#createLocator:

  • if the page object field contains annoation WithTimeout, it would create a new TimeOutDuration instance.
  • This instance would be passed to AppiumElementLocator.
  • When element tries to find the element. It would invoke method AppiumElementLocator#waitFor. See the line in finally block. it would change the global implicit wait time using the WithTimeout value.

So this would make the page object and global appium driver implicit wait both change to that value. It would mess the implicit timeout when there are many WithTimeout elements in page objects that contains driver.findElement methods.

There is no getter for implicit wait by design. so it is not easy to fix this.

Solution suggestion:
IMO changing constructors that also passes original timeout duration as argument, in finally block it would set back to original timeout duration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions