From ec150badba269debced37660cb2af99221b91e36 Mon Sep 17 00:00:00 2001 From: Pythagodzilla Date: Thu, 22 Jan 2026 10:02:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=9C=A8=E6=9C=AC=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=B8=AD=E5=A4=84=E7=90=86=E9=87=8D=E5=A4=8D=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E8=BF=87=E7=A8=8B=EF=BC=8C=E8=87=AA=E8=A1=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8cron=E7=AE=A1=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 1 + run.py | 8 ++++---- utils.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0750be5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +selenium~=4.33.0 \ No newline at end of file diff --git a/run.py b/run.py index 623626c..5135151 100644 --- a/run.py +++ b/run.py @@ -1,5 +1,5 @@ -import time import selenium.common + from utils import Bing User_profile_chrome = ["chromium"] @@ -8,15 +8,15 @@ def main(): try: driver = Bing.init_driver() Bing.get_points(driver=driver) - time.sleep(10) - Bing.get_points(driver=driver) - time.sleep(10) driver.quit() print("quit") except selenium.common.exceptions.WebDriverException as e: print(e) + except Exception as e: + print(e) + if __name__ == "__main__": main() diff --git a/utils.py b/utils.py index 14dcc23..a637b29 100644 --- a/utils.py +++ b/utils.py @@ -14,7 +14,7 @@ class Bing: options = Options() # options.add_argument("--headless") # Run in headless mode options.add_argument("--no-sandbox") - options.add_experimental_option("detach", True) + options.add_experimental_option("detach", False) options.add_argument("--disable-dev-shm-usage") options.add_argument(f"--user-data-dir=/tmp/chrome-profile") # options.add_argument(f"--user-data-dir=C:\\Users\\Plane\\AppData\\Local\\Microsoft\\Edge\\{profile_path}")