title: How to properly use By class in selenium with python
body: <p>I've written a code to test a page in python with selenium. The code works but now I'm trying to rewrite it better.<br>
  I have created a <code>locators.py</code> file as described in the following documentation: <a href="http://selenium-python.readthedocs.io/page-objects.html" rel="noreferrer">selenium python binding - page objects</a>.<br>
  For simple locators this is straightforward.
  This is what I've done so far:</p>
  
  <pre><code>from selenium.webdriver.common.by import By
  
  class PhotoHomePageLocators(object):
  """A class for photographer home page locators. All photographer interface home page locators should come here"""
  add_new_project_btn = (By.CLASS_NAME, 'addProject')
  view_all_projects_btn = (By.CLASS_NAME, 'viewAllProjects')
  
  
  class NameCoverPageLocators(object):
  """A class for name and cover home page locators. All name and cover page locators should come here"""
  project_name_txt_box = (By.XPATH, '//*[@id="rform_pt2_0"]')
  client_name_txt_box = (By.XPATH, '//*[@id="rform_pt2_1"]')
  client_email_txt_box = (By.XPATH, '//*[@id="rform_pt2_2"]')
  </code></pre>
  
  <p>but I have the following line in my code which I'm uncertain how to write so it fits the above syntax:</p>
  
  <pre><code>driver.find_element_by_class_name('coverUpload').find_element_by_class_name('pButton').click()
  </code></pre>
  
  <p>I'm locating a class within a class, there are several <code>pButton</code> classes in the page, but only one inside the <code>coverUpload</code> class.</p>