Following is my python selenium code
def provideDetails(self, titleEleName, titleText, sbmtBtnName, dropdownOptn, dropdownName):
self.ui.jobs.setJobTitleEleName(titleEleName, titleText)
elem = self.ui.jobs.selectButton(dropdownName)
if elem.is_displayed():
self.ui.jobs.selectButton(dropdownName)
self.ui.sleep(4)
self.ui.jobs.selectAor(dropdownOptn)
else:
self.ui.jobs.selectAddAors(dropdownOptn)
self.ui.sleep(4)
self.ui.jobs.selectButton(sbmtBtnName)
I have to check, if the 'elem' is present or not. And if it is present, 'if' condition should happen, and if not, 'else' condition should work. I tried this code. And I got this error "Attribute error: None Type object has no attribute 'is_displayed'. Any help would be appreciated. Thanks.
Also, Is there any alternative method to check if an element exists and follow with the if else commands