def test_example_element(needle):
"""Example for comparing individual elements
:param NeedleDriver needle: NeedleDriver instance
:return:
"""
# Navigate to web page
needle.driver.get('https://www.google.com')
# Ensure the cursor does not appear in the screenshot
footer = needle.driver.find_elements_by_xpath('//div[@class="fbar"]')
if footer:
footer[0].click()
# Take an element screen diff
needle.assert_screenshot('search_field', (By.ID, 'tsf'), threshold=80)
评论列表
文章目录