Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Add logic to solve the problem with the temporary inability to interact with the element. #4727

Closed
niyarlatotep opened this issue Mar 12, 2018 · 3 comments

Comments

@niyarlatotep
Copy link

Feature Request
Add logic for handle with modal windows and elements not attached to the DOM.

  1. Add retry logic, for actions with elements, like click, with parameters (how many times and timeout) and/or add some expected condition which will check if element is clickable (expect if other element wouldn’t get click);
  • Reasons for adopting new feature
    Sometimes tests fail because of modal window that appears and disappears (for example after deleting an object). While exists modal window click other element will fail, and we can't handle modal window disappearing moment. The same problem with moving element (with css animation) if we have retry or expected condition it could be resolved. A similar problem with element that not attached to the DOM, from moment of element finding and action.

There’s two ways for resolving this issue

  1. Add some browser.sleep, but if modal window exists time increase it will fail and if sleep time long, test will slow.
  2. Add retry logic, retry(elem.click, howManyTimes, timeout).
    Could be cool to have “retry” functionality by default, and one common config for it (by default there could be zero retries there), and may be some custom parameters passed in method: elem.click(howManyTimes, timeout)
  • Is this a breaking change? (How will this affect existing functionality)
    Don't know.
@sri85
Copy link

sri85 commented Apr 13, 2018

@niyarlatotep It could be worth checking https://github.com/juliemr/webdriverjs-retry , it exactly does what you need

@niyarlatotep
Copy link
Author

@sri85 As I see, it uses promise.controlflow, but i'd prefer not to use promise.controlflow (as i know it'll be removed, SeleniumHQ/selenium#2969 ). And I also want it to be out of box, without calling a separate function. I'd like to have one option (use these logic or not, and timeout), if for example i set it to use this logic, it will retry methods implcitly. Example: test try to click button that hidden by a modal window for some time, in this case method click will retry (implicitly) to click for some (preset) time, without calling an external method explicitly.

@niyarlatotep
Copy link
Author

It easier to do it yourself

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants