If the element has no text, assert_text prints AssertionError: Element None has no text attribute

Bug #1166408 reported by Leo Arias
6
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

Leo Arias (elopio)
Changed in selenium-simple-test:
assignee: nobody → Leo Arias (elopio)
status: Triaged → In Progress
Changed in selenium-simple-test:
status: In Progress → Fix Committed
Vincent Ladeuil (vila)
Changed in selenium-simple-test:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.