Reputation: 571
I am runnning the following script in the browser
webdriver.execute_script("document.getElementsByClassName('bulk_item').length")
and I want the number this script returns to be assigned to an elem
variable that I can access.
Direct assignment doesn't work.
The error is on line :
self.assertEqual(elem_before+1, elem_after, "UPLOAD FAILED")
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Upvotes: 0
Views: 64
Reputation: 1088
Add a return
statement.
webdriver.execute_script("return document.getElementsByClassName('bulk_item').length")
Upvotes: 1