-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
+ reuse mixins in core.Element, core.All_, core.Client (new name for core.Context) + break down entity.py into separate modules per actual entity implementation
- Loading branch information
Showing
33 changed files
with
1,616 additions
and
1,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 13 additions & 13 deletions
26
examples/custom_condition_be_visible_in_view_port/framework/extensions/selene/be.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
from selene import Element | ||
from selene.core.condition import Condition | ||
from selene import web | ||
from selene.core.condition import Condition, Match | ||
from selene.core.conditions import ElementCondition | ||
from selene.support.conditions.be import * # noqa | ||
from selene.support.conditions.be import not_ as _original_not_ # noqa | ||
|
||
not_ = _original_not_ | ||
|
||
visible_in_viewport: Condition[Element] = ElementCondition.raise_if_not( | ||
visible_in_viewport: Condition[web.Element] = Match( | ||
'is visible in view port', | ||
lambda element: element.execute_script( | ||
by=lambda element: element.execute_script( | ||
''' | ||
var rect = element.getBoundingClientRect(); | ||
var rect = element.getBoundingClientRect(); | ||
return ( | ||
rect.top >= 0 && | ||
rect.left >= 0 && | ||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | ||
rect.right <= (window.innerWidth || document.documentElement.clientWidth) | ||
); | ||
''' | ||
return ( | ||
rect.top >= 0 && | ||
rect.left >= 0 && | ||
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | ||
rect.right <= (window.innerWidth || document.documentElement.clientWidth) | ||
); | ||
''' | ||
), | ||
) | ||
|
||
not_visible_in_viewport: Condition[Element] = visible_in_viewport.not_ | ||
not_visible_in_viewport: Condition[web.Element] = visible_in_viewport.not_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.