So I am working with selenium for some automation and I was using get_attribute to compare values to assign whether a variable would be true or false.
So my question is, when I use get_attribute and it returns the value of 'None' ( This is expected since the element I am looking for does not exist), is that value returned as a String? And if it is, then my question would be, why am I unable to compare it as I would any other string.
active_establishment = CRM_driver.find_element_by_xpath('//*[@id="gridBodyTable"]').get_attribute("records")
print(active_establishment)
if active_establishment == 'None':
party[x].establishment = False
else:
party[x].establishment = True
active_establishments = None
establishments = True (expected results should be False)
pythonactive_establishment = str(CRM_driver.find_element_by_xpath('//*[@id="gridBodyTable"]').get_attribute("records"))This means that when get_attribute returns 'None', it is neither a null or a string. So what is it?None. Not sure how you are gettingNonehere. However, the type isNoneType.party[x].establishment = active_establishment != 'None'.