# Buggy code
def __init__(self, username=None, password=None, nogui=False):
    if nogui:
        self.display = Display(visible=0, size=(800, 600))
        self.display.start()

    chrome_options = Options()
    chrome_options.add_argument("--dns-prefetch-disable")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--lang=en-US")
    chrome_options.add_experimental_option("prefs", {"intl.accept_languages": "en-US"})
    self.browser = webdriver.Chrome(
        "./assets/chromedriver", chrome_options=chrome_options
    )
    self.browser.implicitly_wait(25)

    self.logFile = open("./logs/logFile.txt", "a")
    self.logFile.write(
        "Session started - %s\n" % (datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    )

    self.username = username or environ.get("INSTA_USER")
    self.password = password or environ.get("INSTA_PW")
    self.nogui = nogui

    self.do_comment = False
    self.comment_percentage = 0
    self.comments = ["Cool!", "Nice!", "Looks good!"]
    self.photo_comments = []
    self.video_comments = []

    self.followed = 0
    self.follow_restrict = load_follow_restriction()
    self.follow_times = 1
    self.do_follow = False
    self.follow_percentage = 0
    self.dont_include = []
    self.automatedFollowedPool = []

    self.dont_like = ["sex", "nsfw"]
    self.ignore_if_contains = []
    self.ignore_users = []

    self.use_clarifai = False
    self.clarifai_secret = None
    self.clarifai_id = None
    self.clarifai_img_tags = []
    self.clarifai_full_match = False

    self.like_by_followers_upper_limit = 0
    self.like_by_followers_lower_limit = 0

    self.aborting = False


# Traceback (selenium.common.exceptions.WebDriverException)
Traceback (most recent call last):
File "LikeSCript.py", line 16, in <module>
.like_by_tags([<My Tags>], amount=300, media='Photo')\
File "/root/InstaPy/instapy/instapy.py", line 386, in like_by_tags
liked = like_image(self.browser)
File "/root/InstaPy/instapy/like_util.py", line 279, in like_image
browser.execute_script("document.getElementsByClassName('" + like_elem[0].get_attribute("class") + "')[0].click()")
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 111, in get_attribute
resp = self._execute(Command.GET_ELEMENT_ATTRIBUTE, {'name': name})
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Session info: chrome=59.0.3071.109)
(Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-81-generic x86_64)

# Fixed code
def __init__(self, username=None, password=None, nogui=False):
    if nogui:
        self.display = Display(visible=0, size=(800, 600))
        self.display.start()

    chromedriver_location = "./assets/chromedriver"
    chrome_options = Options()
    chrome_options.add_argument("--dns-prefetch-disable")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--lang=en-US")
    chrome_options.add_experimental_option("prefs", {"intl.accept_languages": "en-US"})
    chrome_options.binary_location = chromedriver_location
    self.browser = webdriver.Chrome(
        chromedriver_location, chrome_options=chrome_options
    )
    self.browser.implicitly_wait(25)

    self.logFile = open("./logs/logFile.txt", "a")
    self.logFile.write(
        "Session started - %s\n" % (datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
    )

    self.username = username or environ.get("INSTA_USER")
    self.password = password or environ.get("INSTA_PW")
    self.nogui = nogui

    self.do_comment = False
    self.comment_percentage = 0
    self.comments = ["Cool!", "Nice!", "Looks good!"]
    self.photo_comments = []
    self.video_comments = []

    self.followed = 0
    self.follow_restrict = load_follow_restriction()
    self.follow_times = 1
    self.do_follow = False
    self.follow_percentage = 0
    self.dont_include = []
    self.automatedFollowedPool = []

    self.dont_like = ["sex", "nsfw"]
    self.ignore_if_contains = []
    self.ignore_users = []

    self.use_clarifai = False
    self.clarifai_secret = None
    self.clarifai_id = None
    self.clarifai_img_tags = []
    self.clarifai_full_match = False

    self.like_by_followers_upper_limit = 0
    self.like_by_followers_lower_limit = 0

    self.aborting = False