import os
import platform
import requests
import zipfile
import io
def delete_old_chromedriver(path):
if os.path.exists(path):
os.remove(path)
print(f"Eski chromedriver silindi: {path}")
else:
print("Eski chromedriver bulunamadı.")
def get_chromedriver_url():
arch = platform.architecture()[0]
if arch == '32bit':
return "https://storage.googleapis.com/chromedriver-win32.zip"
else:
return "https://storage.googleapis.com/chromedriver-win64.zip"
def download_chromedriver(url, save_path):
response = requests.get(url)
response.raise_for_status()
zip_file = zipfile.ZipFile(io.BytesIO(response.content))
zip_file.extractall(save_path)
print("Yeni chromedriver indirildi ve çıkarıldı.")
def main():
chromedriver_path = "C:\\newfiles\\chromedriver.exe"
# Eski chromedriver'ı sil
delete_old_chromedriver(chromedriver_path)
# Yeni chromedriver URL'sini al
url = get_chromedriver_url()
# Yeni chromedriver'ı indir
download_chromedriver(url, "C:\\newfiles")
if __name__ == "__main__":
main()
Bunu bi deneyin hocam