'Python Selenium if statement issue

I am trying to create a if statement using js-cart-count within the span element. I'm having a hard time trying to get this part js-cart-count="">(0) to be added to my if statement.

HTML code I'm using:

span class="site-header__cart-count" js-cart-count="">(0)</span

code:

ItemInCart = driver.find_elements_by_xpath('//span[@class="site-header__cart-count"]')

if itemincart!= False:
    print('item in cart')
else:
    print('item not cart')
driver.refresh()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source