robotframework-imagehorizonlibrary icon indicating copy to clipboard operation
robotframework-imagehorizonlibrary copied to clipboard

Feature Request: Add optional timeout on functions that use reference_image

Open damies13 opened this issue 3 years ago • 3 comments
trafficstars

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 avatar Feb 25 '22 13:02 damies13

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

damies13 avatar Feb 25 '22 13:02 damies13

@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.

Tattoo avatar Feb 25 '22 14:02 Tattoo

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 avatar Feb 25 '22 22:02 damies13