If the element has no text, assert_text prints AssertionError: Element None has no text attribute
Bug #1166408 reported by
Leo Arias
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
selenium-simple-test |
Fix Released
|
Undecided
|
Leo Arias |
Bug Description
A test is failing because it tries to assert the text of an element that is showing no text.
The failure is correct, but the error message is bad:
AssertionError: Element None has no text attribute
We should print the element instead of None.
real = _get_text(elem)
if real is None:
msg = 'Element %r has no text attribute' % _get_text(elem)
Here we know that _get_text will return None, and we are still using it for the message.
Related branches
lp:~elopio/selenium-simple-test/fix1166408-assert_text_with_no_text
- Vincent Ladeuil (community): Approve
-
Diff: 71 lines (+41/-1)3 files modifiedsrc/sst/actions.py (+5/-1)
src/sst/selftests/assert_text.py (+35/-0)
src/testproject/templates/index.html (+1/-0)
Changed in selenium-simple-test: | |
assignee: | nobody → Leo Arias (elopio) |
status: | Triaged → In Progress |
Changed in selenium-simple-test: | |
status: | In Progress → Fix Committed |
Changed in selenium-simple-test: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.