Closed JohnScience closed 8 months ago
Source of the problem:
selenium_dolphin/selenium_dolphin.py
:
def get_dolphin_driver():
html = requests.get('https://dolphin-anty.com/docs/basic-automation/#selenium').text
driver_slices = html.split('/chromedriver')
server_url = driver_slices[0].split('"')[-1]
version = driver_slices[1].split('"')[0]
file_name = 'chromedriver' + version
driver_url = server_url + '/' + file_name
if not os.path.exists(file_name) and not os.path.exists('chromedriver'):
download_driver(driver_url, file_name)
with zipfile.ZipFile(file_name, 'r') as z:
z.extractall('')
if os.path.exists('chromedriver'):
drivers = os.listdir('chromedriver')
system = platform.system()
architecture = platform.machine()
for driver_file in drivers:
if system == 'Windows' and '.exe' in driver_file:
if '64' in architecture and '64' in driver_file:
break
elif '32' in driver_file and not '64' in architecture:
break
elif system == 'Darwin':
if 'arm' in architecture and 'arm' in driver_file:
break
elif 'intel' in driver_file:
break
elif system == 'Linux' and 'linux' in driver_file:
break
if not driver_file:
raise ValueError("Unsupported platform")
driver_path = os.path.join(os.getcwd(), 'chromedriver', driver_file)
return driver_path
More precisely,
def get_dolphin_driver():
# ...
if os.path.exists('chromedriver'):
# ...
driver_path = os.path.join(os.getcwd(), 'chromedriver', driver_file)
return driver_path
I.e. driver_path
gets defined only in one of the branches of the if statement.
@DedInc Fixed the problem in #4
Script:
Output: