Skip to content
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

Feature Request: Add optional timeout on functions that use reference_image #61

Open
damies13 opened this issue Feb 25, 2022 · 3 comments

Comments

@damies13
Copy link

This feature request (well more a suggestion) is aimed primarily at the Click * Image and Does Exist keywords.

This feature would make imagehorizonlibrary behave more similarly to SeleniumLibrary and BrowserLibrary in that they both have a timeout waiting for the element to exist rather than failing immediately if the element is not already on the screen. I believe this change would make imagehorizonlibrary more user friendly especially to people new to this library.

My proposed solution would be simply to replace the self.locate with self.wait_for in the Click Image functions and probably also the Does Exist function. An optional timeout argument would be added to be passed to the wait_for function, this would be by default be set to 0 so that the current behaviour of these keywords is unchanged.

Obviously Issue #60 would need to be fixed first for this to work.

If this feature is also included on the locate keyword function it would make wait for redundant, not sure if that is a good or bad thing, but there is the possibility of consolidating those two.

An additional a keyword for set default timeout could also be added to change the default timeout from 0 to a value that the user chooses.

@damies13
Copy link
Author

If the project owner likes this suggestion and would like i'd be happy to try implementing this feature.

@Tattoo
Copy link
Contributor

Tattoo commented Feb 25, 2022

@damies13 ,

Does exist is intended for a keyword that one can use to verify something right now. If user has a situation they might need to wait, they can use Wait for. Am I missing a reason you would like to change this design?

With the Click * keywords, I agree with your suggestion wholeheartedly.

I'm currently bit busy for at least a month so contributions if you have time are more than welcome :) Reviewing & releasing I can do in timely manner.

@damies13
Copy link
Author

The only reason for adding to Does exist was for consistency in behaviour, so that users would know any keyword that uses a reference image could have a timeout added. I'm happy to add this to the Click * keywords and leave it off Does exist if that's your preference. Dave.

damies13 added a commit to damies13/robotframework-imagehorizonlibrary that referenced this issue Feb 27, 2022
Keywords that now have the optional timeout are:
- Click Image
- Click To The Above Of Image
- Click To The Below Of Image
- Click To The Left Of Image
- Click To The Right Of Image
- Copy From The Above Of
- Copy From The Below Of
- Copy From The Left Of
- Copy From The Right Of

The default timeout is 0 sec so there is no functional change from previous version unless a timeout is set, this does require  Pull request eficode#64 (fix for issue eficode#60) as a prerequisite for this change in order to work as expected. Please only merge after Pull request eficode#64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants