Create utils/setup_chromedriver.py
Browse files- utils/setup_chromedriver.py +20 -0
utils/setup_chromedriver.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
def install_chrome_and_driver():
|
| 5 |
+
if not os.path.exists("/usr/bin/google-chrome"):
|
| 6 |
+
print("Installing Google Chrome...")
|
| 7 |
+
subprocess.run([
|
| 8 |
+
"wget", "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"
|
| 9 |
+
])
|
| 10 |
+
subprocess.run(["apt-get", "update"])
|
| 11 |
+
subprocess.run(["apt", "install", "-y", "./google-chrome-stable_current_amd64.deb"])
|
| 12 |
+
|
| 13 |
+
if not os.path.exists("/usr/bin/chromedriver"):
|
| 14 |
+
print("Installing ChromeDriver...")
|
| 15 |
+
subprocess.run([
|
| 16 |
+
"wget", "https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip"
|
| 17 |
+
])
|
| 18 |
+
subprocess.run(["unzip", "chromedriver_linux64.zip"])
|
| 19 |
+
subprocess.run(["mv", "chromedriver", "/usr/bin/chromedriver"])
|
| 20 |
+
subprocess.run(["chmod", "+x", "/usr/bin/chromedriver"])
|