0

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'

1 Answer 1

1

Add a return statement.

webdriver.execute_script("return document.getElementsByClassName('bulk_item').length")

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.