title: Test View in Django that requires Login session Selenium
body: <p>I would like to test a View in Django using Sellenium that has a decorator, that requires being logged in:</p>
  
  <pre><code>@method_decorator(login_required, name='dispatch')
  </code></pre>
  
  <p>This is how mu code looks like:</p>
  
  <pre><code>class TestAddOrder(LiveServerTestCase):
    def setUp(self):
      self.selenium = webdriver.Firefox()
      super(TestAddOrder, self).setUp()
  
  
    def tearDown(self):
      self.selenium.quit()
      super(TestAddOrder, self).tearDown()
  
    def test_add_order(self):
      selenium = self.selenium
      selenium.get('http://127.0.0.1:8000/orders/create/')
  
      date = selenium.find_element_by_name('date').send_keys('01/31/2019')
      hours = selenium.find_element_by_id('id_hour').send_keys('18')
  
      submit = selenium.find_element_by_name('submit').send_keys(Keys.RETURN).send_keys(Keys.RETURN)
  </code></pre>
  
  <p>And the error:</p>
  
  <pre><code>selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [name="date"]
  </code></pre>
  
  <p>How can I keep the session of logged in user when trying to automise my test with Sellenium?</p>