Такова структура проекта.

def start_driver():
try:
url = 'https://antcpt.com/anticaptcha-plugin.zip'
filehandle, _ = urllib.request.urlretrieve(url)
with zipfile.ZipFile(filehandle, "r") as f:
f.extractall("plugin")
api_key = "MY API KEY"
file = Path('./plugin/js/config_ac_api_key.js')
file.write_text(file.read_text().replace("antiCapthaPredefinedApiKey = ''", "antiCapthaPredefinedApiKey = '{}'".format(api_key)))
zip_file = zipfile.ZipFile('./plugin.zip', 'w', zipfile.ZIP_DEFLATED)
for root, dirs, files in os.walk("./plugin"):
for file in files:
path = os.path.join(root, file)
zip_file.write(path, arcname=path.replace("./plugin/", ""))
zip_file.close()
chrome_options = webdriver.ChromeOptions()
chrome_options.add_extension('./plugin.zip')
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(options=chrome_options)
return driver
except Exception as e:
print("Error al iniciar el controlador:", e)
return None
if __name__ == '__main__':
driver = start_driver()
но я получаю сообщение об ошибке
Message: session not created: cannot process extension #1 from unknown error: cannot read manifest
Подробнее здесь: https://stackoverflow.com/questions/780 ... xtension-1