Web経由でPythonのseleniumでzipファイルを保存しようとするとエラーになる
解決したいこと
Python初心者です。
ログインしないとZIPファイルのダウンロードをできないサーバーがありseleniumでログインしてzipファイルのダウンロードをしたいのですが、
ローカル環境では、コマンド上に支障の無さそうなエラーが出ますが、ダウンロードはできます。
実際に使用したいのは、PHPからコマンドを実行して、ファイルをダウンロードすることですが、多数のGPUエラーが出て、ダウンロードが失敗します。
試したこと
Headlessモードも試しましたが、Headlessモードだとローカルでもダウンロードに失敗します。
管理者として実行してもダメでした。
いろいろ試しましたが、わからなくなったのでお助けください。
使用環境
Windows Server 2019
Webサーバー apache
Chrome バージョン 96.0.4664.45
python Anaconda3 version 3.8.8
元のソースです。
login.py
python
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
import time
driver=webdriver.Chrome("C:/Users/Administrator/Desktop/python/chromedriver.exe")
driver.get("https://aaa.com/bbb.zip")
ids="abcd"
pass_w="xxxxxx"
WebDriverWait(driver, 2)
idss=driver.find_element_by_id("AccountLoginid")
idss.send_keys(ids)
pass2=driver.find_element_by_id("AccountPassword")
pass2.send_keys(pass_w)
element = driver.find_element_by_class_name('submit')
element.submit()
time.sleep(10)
import os
import shutil
Initial_path = 'C:/Users/Administrator/Downloads'
filename= max([Initial_path + "\\" + f for f in os.listdir(Initial_path)],key=os.path.getctime)
shutil.move(filename,os.path.join(Initial_path,r"test.zip"))
time.sleep(2)
import zipfile
driver.close()
アドバイスよろしくお願いします。