Get chromedriver path from the system path

This is cross platform and avoids the need to download Chrome Driver to the
project directory.
This commit is contained in:
Victor Engmark 2017-01-12 22:54:48 +00:00
parent da9d09e945
commit c14bf5e2d5

View File

@ -14,6 +14,7 @@ import requests
import os import os
import common import common
import binascii import binascii
import distutils.spawn
def fetch_activation_bytes(username, password, options): def fetch_activation_bytes(username, password, options):
@ -48,10 +49,7 @@ def fetch_activation_bytes(username, password, options):
'openid.return_to': base_url + 'player-auth-token?playerType=software&playerId=%s=&bp_ua=y&playerModel=Desktop&playerManufacturer=Audible' % (player_id) 'openid.return_to': base_url + 'player-auth-token?playerType=software&playerId=%s=&bp_ua=y&playerModel=Desktop&playerManufacturer=Audible' % (player_id)
} }
if sys.platform == 'win32': chromedriver_path = distutils.spawn.find_executable('chromedriver')
chromedriver_path = "chromedriver.exe"
else:
chromedriver_path = "./chromedriver"
driver = webdriver.Chrome(chrome_options=opts, driver = webdriver.Chrome(chrome_options=opts,
executable_path=chromedriver_path) executable_path=chromedriver_path)