Django & Python unittest - find a Div Class -
i writing test in python , 1 part, using beautiful soup want check has gone specific page looking div:class.
the line in test is:
soup = beautifulsoup(response.content) check_tag = len(soup.findall('div', {'class': 'booking-test'})) self.assertequal(check_tag, 1)
when run test returns fail message:
self.assertequal(check_tag, 1) assertionerror: 0 != 1
is correct way test specific div?
your syntax works beautifulsoup 4.3.1. 3.2.1 works if div only has class (ie fails on div class="booking-test other">
nb : not tested other versions assume it's matter of 3.x / 4.x
Comments
Post a Comment