[utils] Support attributes with no values in get_elements_by_attribute()
This commit is contained in:
parent
b6c9fe4162
commit
609ff8ca19
2 changed files with 8 additions and 2 deletions
|
@ -1228,6 +1228,12 @@ part 3</font></u>
|
|||
self.assertEqual(get_element_by_attribute('class', 'foo', html), None)
|
||||
self.assertEqual(get_element_by_attribute('class', 'no-such-foo', html), None)
|
||||
|
||||
html = '''
|
||||
<div itemprop="author" itemscope>foo</div>
|
||||
'''
|
||||
|
||||
self.assertEqual(get_element_by_attribute('itemprop', 'author', html), 'foo')
|
||||
|
||||
def test_get_elements_by_class(self):
|
||||
html = '''
|
||||
<span class="foo bar">nice</span><span class="foo bar">also nice</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue