from selenium import webdriver

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.cache import cache


class BrowserTest(StaticLiveServerTestCase):
    def setUp(self):
        self.browser = webdriver.PhantomJS()
        self.browser.set_window_size(1024, 768)

    def tearDown(self):
        self.browser.quit()
        cache.clear()

from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.chrome.options import Options
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.cache import cache


class BrowserTest(StaticLiveServerTestCase):
    def setUp(self):
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        chrome_options.add_argument("--window-size=1920x1080")
        self.browser = WebDriver(chrome_options=chrome_options)
        self.browser.set_window_size(1024, 768)

    def tearDown(self):
        self.browser.quit()
        cache.clear()

Use headless chrome for functional test
Use headless chrome for functional test

- from selenium import webdriver
- 
+ from selenium.webdriver.chrome.webdriver import WebDriver
+ from selenium.webdriver.chrome.options import Options
  from django.contrib.staticfiles.testing import StaticLiveServerTestCase
  from django.core.cache import cache
  
  
  class BrowserTest(StaticLiveServerTestCase):
      def setUp(self):
-         self.browser = webdriver.PhantomJS()
+         chrome_options = Options()
+         chrome_options.add_argument("--headless")
+         chrome_options.add_argument("--window-size=1920x1080")
+         self.browser = WebDriver(chrome_options=chrome_options)
          self.browser.set_window_size(1024, 768)
  
      def tearDown(self):
          self.browser.quit()
          cache.clear()
  
Use headless chrome for functional test
## Code Before:
from selenium import webdriver

from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.cache import cache


class BrowserTest(StaticLiveServerTestCase):
    def setUp(self):
        self.browser = webdriver.PhantomJS()
        self.browser.set_window_size(1024, 768)

    def tearDown(self):
        self.browser.quit()
        cache.clear()

## Instruction:
Use headless chrome for functional test
## Code After:
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.chrome.options import Options
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.cache import cache


class BrowserTest(StaticLiveServerTestCase):
    def setUp(self):
        chrome_options = Options()
        chrome_options.add_argument("--headless")
        chrome_options.add_argument("--window-size=1920x1080")
        self.browser = WebDriver(chrome_options=chrome_options)
        self.browser.set_window_size(1024, 768)

    def tearDown(self):
        self.browser.quit()
        cache.clear()
