Selenium: Setup Chrome Driver

Here is how to setup chrome driver for selenium functional testing. If you are using firefox, leave this post because selenium by default provide the driver. 😀

Download the driver from
adjust with your OS. After that, extract to your project, for example following my project dir structure.

- myproject
    - myproject
        - apps
            - member
    - chromedriver

then write followed below.

import os

from django.test import LiveServerTestCase
from selenium import webdriver

class MyTestCase(LiveServerTestCase):

    def setUp(self):
        # Get your chrome driver path location.
        current = os.path.dirname(__file__)
        driver_path = os.path.abspath(
            os.path.join(current, '..', '..', '..', 'chromedriver')

        self.selenium = webdriver.Chrome(driver_path)
        super(MyTestCase, self).setUp()

    def tearDown(self):
        super(MyTestCase, self).tearDown()

    def test_open_the_app(self):

NB: Don’t forget to install the selenium. 😀

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.