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

[PY] Implement logical expected conditions in Python #7406

Merged
merged 1 commit into from
Aug 28, 2019

Conversation

GQAssurance
Copy link
Contributor

@GQAssurance GQAssurance commented Jul 18, 2019

Replicates the functionality of Java's AND / OR / NOT expected conditions.
Because of reserved word constraints in Python, these are named:

OR: any_of(*expected_condition)
AND: all_of(*expected_condition)
NOT: none_of(*expected_condition)

Each function takes an unlimited number of expected_conditions as arguments.

Implements #7121

@GQAssurance GQAssurance changed the title Implement AND OR NOT expected_conditions in Python Implement logical expected conditions in Python Jul 19, 2019
@GQAssurance GQAssurance changed the title Implement logical expected conditions in Python [PY] Implement logical expected conditions in Python Jul 19, 2019
result = expected_condition(driver)
if not result:
return False
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return True should be outside the for loop.
Many expected conditions sometimes return the element or object you're waiting for.
Should this return a list of all results?

Copy link
Contributor Author

@GQAssurance GQAssurance Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1) (facepalm) fixed
(2) That's a good idea. the all_of function now returns every EC's result in a list; it could then be parsed for elemental results if needed.

@p0deje p0deje added the C-py label Jul 29, 2019
Replicates the functionality of Java's AND / OR / NOT expected conditions.
Because of reserved word constraints in Python, these are named:

OR:  `any_of(*expected_condition)`
AND: `all_of(*expected_condition)`
NOT: `none_of(*expected_condition)`

Each function takes an unlimited number of expected_conditions as arguments.

Implements SeleniumHQ#7121
@isaulv
Copy link
Contributor

isaulv commented Aug 1, 2019

LGTM.

@GQAssurance
Copy link
Contributor Author

LGTM.

Is there any way I can help get this merged into master?

@AutomatedTester AutomatedTester merged commit ef81299 into SeleniumHQ:master Aug 28, 2019
@GQAssurance GQAssurance deleted the python-logical-ecs branch August 28, 2019 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants