title: Webscraping: How to check if attribute exists and if it doesnt continue without ending program
body: <p>I am trying to webscrape a website to get desired contact information like cellphone, email, adrress, etc,etc...</p>
  
  <p>Some pages will have all information...while some may only have cellphone and email but not address... and any combination of having/not having these fields inbetween...</p>
  
  <p>Ive been playing around with some code but cant quite figure it out</p>
  
  <p>how do i check to see if the information i want exists on a page(because it wont always be consistent) and if it isnt simply ignore and scrape all "available" information and then continue on without breaking the program</p>
  
  <p>code i am trying:</p>
  
  <pre><code>if driver.find_elements_by_class_name('zsg-list_definition'):
                  trial = soup.findAll('dl', {'class': 'zsg-list_definition'})
                  if len(trial[0].dd.text) &gt; 0:
                      address = trial[0].dd.text
                  else:
                      address = 'None'
  
              if driver.find_elements_by_class_name('dont-break-out') == True:
                  websiteURL = soup.find('dd', {'class': 'dont-break-out'})
                  website = websiteURL.a.text
              else:
                      website = 'None'
  
              csv_writer.writerow([address, website])
  </code></pre>
  
  <p>best regards</p>