Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
936b933a
Commit
936b933a
authored
Oct 08, 2013
by
Will Daly
Committed by
Will Daly
Oct 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guard against StaleElementException in css_click
parent
b62abe65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
common/djangoapps/terrain/ui_helpers.py
+8
-6
No files found.
common/djangoapps/terrain/ui_helpers.py
View file @
936b933a
...
...
@@ -336,8 +336,10 @@ def css_click(css_selector, index=0, wait_time=30):
This method will return True if the click worked.
"""
wait_for_clickable
(
css_selector
,
timeout
=
wait_time
)
assert_true
(
world
.
css_find
(
css_selector
)[
index
]
.
visible
,
msg
=
"Element {}[{}] is present but not visible"
.
format
(
css_selector
,
index
))
assert_true
(
world
.
css_visible
(
css_selector
,
index
=
index
),
msg
=
"Element {}[{}] is present but not visible"
.
format
(
css_selector
,
index
)
)
# Sometimes you can't click in the center of the element, as
# another element might be on top of it. In this case, try
...
...
@@ -368,9 +370,10 @@ def css_click_at(css_selector, index=0, x_coord=10, y_coord=10, timeout=5):
rather than in the center of the element
'''
wait_for_clickable
(
css_selector
,
timeout
=
timeout
)
element
=
css_find
(
css_selector
)[
index
]
assert_true
(
element
.
visible
,
msg
=
"Element {}[{}] is present but not visible"
.
format
(
css_selector
,
index
))
assert_true
(
world
.
css_visible
(
css_selector
,
index
=
index
),
msg
=
"Element {}[{}] is present but not visible"
.
format
(
css_selector
,
index
)
)
element
.
action_chains
.
move_to_element_with_offset
(
element
.
_element
,
x_coord
,
y_coord
)
element
.
action_chains
.
click
()
...
...
@@ -512,7 +515,6 @@ def retry_on_exception(func, max_attempts=5, ignored_exceptions=StaleElementRefe
while
attempt
<
max_attempts
:
try
:
return
func
()
break
except
ignored_exceptions
:
world
.
wait
(
1
)
attempt
+=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment