{"id":4561,"date":"2025-05-09T15:57:11","date_gmt":"2025-05-09T07:57:11","guid":{"rendered":"https:\/\/dasmz.com\/?p=4561"},"modified":"2025-05-09T22:24:15","modified_gmt":"2025-05-09T14:24:15","slug":"debian-12%e7%b3%bb%e7%bb%9f%e4%b8%8b%ef%bc%8c%e5%ae%89%e8%a3%85chrome%e6%b5%8f%e8%a7%88%e5%99%a8%ef%bc%8c%e5%ae%89%e8%a3%85chrome-driver","status":"publish","type":"post","link":"https:\/\/dasmz.com\/?p=4561","title":{"rendered":"Debian 12\u7cfb\u7edf\u4e0b\uff0c\u5b89\u88c5chrome\u6d4f\u89c8\u5668\uff0c\u5b89\u88c5chrome driver"},"content":{"rendered":"\n<p><strong>\u524d\u7f00\u3001\u6587\u6863\u4fee\u6539\u8bb0\u5f55<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">20250509 \u521d\u59cb\u5316\u7f16\u8f91\u6b64\u6587\u7ae0\uff0c\u5b8c\u7a3f<\/pre>\n\n\n\n<p><strong>\u7ae0\u82821\u3001\u9700\u6c42\u63cf\u8ff0<\/strong><\/p>\n\n\n\n<p>Debian 12\u7cfb\u7edf\u4e0b\uff0c\u5b89\u88c5chrome\u6d4f\u89c8\u5668\uff0c\u914d\u5957\u5b89\u88c5chrome driver\uff0c\u4ee5\u4fbf\u7528\u7a0b\u5e8f\u6765\u9a71\u52a8Chrome\u6d4f\u89c8\u5668<\/p>\n\n\n\n<p>\u7ae0\u82822\u3001\u64cd\u4f5c\u6b65\u9aa4<\/p>\n\n\n\n<p>2.1\u3001\u5b89\u88c5\u5fc5\u8981\u7684\u5de5\u5177<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@server:~# apt update\nroot@server:~# apt install wget curl unzip<\/pre>\n\n\n\n<p>2.2\u3001\u4e0b\u8f7dChrome\u6d4f\u89c8\u5668<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@server:~# mkdir -p \/root\/src\n\nroot@server:~# cd \/root\/src\n\nroot@server:~# wget https:\/\/dl.google.com\/linux\/direct\/google-chrome-stable_current_amd64.deb\n  \/\/ \u4ece Google \u5b98\u65b9\u4e0b\u8f7d\u5b89\u88c5\u5305<\/pre>\n\n\n\n<p>2.3\u3001\u5b89\u88c5Chrome\u6d4f\u89c8\u5668<\/p>\n\n\n\n<p>\u4f7f\u7528 dpkg \u5b89\u88c5\uff0c\u5982\u679c\u6709\u4f9d\u8d56\u95ee\u9898\uff0c\u518d\u7528 apt \u4fee\u590d\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@server:~#  cd \/root\/src\/\n\nroot@server:~#  dpkg -i google-chrome-stable_current_amd64.deb\n  \/\/ \u672c\u6b21\u5b89\u88c5\u5230\u7684\u7248\u672c\u662f136.0.7103.92-1 Tag-2025-5-9\n\nroot@server:~#  apt --fix-broken install -y\n  \/\/ \u6267\u884c\u8def\u5f84 \/usr\/bin\/google-chrome<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"716\" height=\"598\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-14-33.png\" alt=\"\" class=\"wp-image-4571\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-14-33.png 716w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-14-33-624x521.png 624w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/figure>\n\n\n\n<p>\u786e\u8ba4\u7248\u672c\u4fe1\u606f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@server:~#  \/usr\/bin\/google-chrome -version\nGoogle Chrome 136.0.7103.92  \n\n\/\/ Tag-2025-5-9 \u8f93\u51fa\u7248\u672c\u53f7\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f<\/pre>\n\n\n\n<p>2.4\u3001\u4e0b\u8f7d\u548c\u5b89\u88c5 ChromeDriver<\/p>\n\n\n\n<p>ChromeDriver \u7248\u672c\u9700\u8981\u548c Chrome \u6d4f\u89c8\u5668\u7248\u672c\u5bf9\u5e94\uff0c\u6240\u4ee5\uff0c\u521a\u521a\u5b89\u88c5\u7684Chrome\u7248\u672c\u52a1\u5fc5\u8bb0\u5f55\u4e0b\u6765\u3002<\/p>\n\n\n\n<p>\u4f4e\u4e8e115\u7684\u7248\u672c\u7684\u5b98\u65b9\u5730\u5740 <a href=\"https:\/\/chromedriver.chromium.org\/downloads\" data-type=\"URL\" data-id=\"https:\/\/chromedriver.chromium.org\/downloads\">https:\/\/chromedriver.chromium.org\/downloads<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/developer.chrome.com\/docs\/chromedriver\/downloads\">https:\/\/developer.chrome.com\/docs\/chromedriver\/downloads<\/a><\/p>\n\n\n\n<p>\u56fe\/\u5b98\u65b9\u63d0\u793a\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"778\" height=\"77\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-27-53.png\" alt=\"\" class=\"wp-image-4582\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-27-53.png 778w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-27-53-768x76.png 768w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-16-27-53-624x62.png 624w\" sizes=\"(max-width: 778px) 100vw, 778px\" \/><\/figure>\n\n\n\n<p>\u9ad8\u4e8e115\u6216\u8005\u66f4\u65b0\u7248\u672c\u7684\u5b98\u65b9\u5730\u5740 <a href=\"https:\/\/googlechromelabs.github.io\/chrome-for-testing\/\">https:\/\/googlechromelabs.github.io\/chrome-for-testing\/<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"1618\" height=\"819\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-18-18-23.png\" alt=\"\" class=\"wp-image-4585\" srcset=\"https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-18-18-23.png 1618w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-18-18-23-768x389.png 768w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-18-18-23-1536x777.png 1536w, https:\/\/dasmz.com\/wp-content\/uploads\/2025\/05\/Screenshot-from-2025-05-09-18-18-23-624x316.png 624w\" sizes=\"(max-width: 1618px) 100vw, 1618px\" \/><\/figure>\n\n\n\n<p>\u4e0b\u8f7d\u5176\u4e2dchromedriver\u7684linux64\u7248\u672c\u5373\u53ef\uff0chttps:\/\/storage.googleapis.com\/chrome-for-testing-public\/136.0.7103.92\/linux64\/chromedriver-linux64.zip<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@server:~#  cd \/root\/src\/\n\nroot@server:~#  wget https:\/\/storage.googleapis.com\/chrome-for-testing-public\/136.0.7103.92\/linux64\/chromedriver-linux64.zip\n  \/\/ \u7248\u672c\u7f16\u53f7\u8981\u8ddfChrome\u6d4f\u89c8\u5668\u7684\u4e00\u81f4\n\n\nroot@server:~# unzip chromedriver-linux64.zip\nArchive:  chromedriver-linux64.zip\n  inflating: chromedriver-linux64\/LICENSE.chromedriver  \n  inflating: chromedriver-linux64\/THIRD_PARTY_NOTICES.chromedriver  \n  inflating: chromedriver-linux64\/chromedriver  \nroot@server:~#  \n\nroot@server:~# mv chromedriver-linux64\/chromedriver \/usr\/bin\/chromedriver\nroot@server:~# chmod +x \/usr\/bin\/chromedriver\n  \/\/ \u632a\u76ee\u5f55\uff0c\u8d4b\u6743\u9650\n\nroot@server:~# chromedriver --version\n  \/\/ \u786e\u8ba4\u7248\u672c\u53f7\uff0c\u663e\u793a\u5c31\u662f\u6b63\u5e38\u7684\uff0c\u52a1\u5fc5\u8ddfChrome\u7248\u672c\u4e00\u81f4\n<\/pre>\n\n\n\n<p>\u7ae0\u82823\u3001\u6d4b\u8bd5\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/usr\/bin\/python3\n# -*- coding:utf-8 -*-\n# by Dasmz\n# 2025-5-9\n# \nimport time\nimport random\nfrom datetime import datetime\nfrom selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\n\nCHROMEDRIVER_PATH = '\/usr\/bin\/chromedriver'\nSCREENSHOT_PATH = '\/var\/www\/html\/ScreenShot.png'\n\nURL_LIST = ['URL1','URL2','URL3','URL4','URL5'...]\n\ndef getNow():\n    now = datetime.now()\n    return now.strftime(\"%Y-%m-%d %H:%M:%S\")\n    \ndef create_driver(user_agent):\n    chrome_options = webdriver.ChromeOptions()\n    chrome_options.add_argument('--headless')  # \u65e0\u754c\u9762\u6a21\u5f0f\n    chrome_options.add_argument(\"--window-size=1920x1080\")  # \u7a97\u53e3\u5927\u5c0f\n    chrome_options.add_argument('--disable-gpu')   # \u5173\u95edGPU\u52a0\u901f\n    chrome_options.add_argument(\"--mute-audio\")   # \u5173\u95ed\u58f0\u97f3\n    chrome_options.add_argument(\"--no-sandbox\")   # \u65e0\u6c99\u7bb1\n    chrome_options.add_argument(\"--disable-dev-shm-usage\")  # \u4e0d\u4f7f\u7528\/dev\/shm\u5171\u4eab\u5185\u5b58\u76ee\u5f55\n    chrome_options.add_argument(\"--disable-extensions\")   # \u5173\u95ed\u6269\u5c55\u7a0b\u5e8f\n    chrome_options.add_argument(\"--log-level=3\")   # \u53ea\u663e\u793a\u81f4\u547d\u9519\u8befFATAL\n    chrome_options.add_argument('--disable-application-cache')   # \u5173\u95ed Chrome \u7684\u5e94\u7528\u7f13\u5b58\uff0c\u5305\u62ec\u9875\u9762\u7f13\u5b58\u3001\u79bb\u7ebf\u7f13\u5b58\n    chrome_options.add_argument('--incognito')   # \u9690\u8eab\u6a21\u5f0f\uff0c\u6bcf\u6b21\u6253\u5f00\u7f51\u9875\u90fd\u662f\u65b0\u4f1a\u8bdd\uff0c\u4e0d\u4f1a\u7528\u7f13\u5b58\u3001\u4e5f\u4e0d\u4f1a\u4fdd\u5b58 cookie\n    chrome_options.add_argument('--disk-cache-size=0')   # \u78c1\u76d8\u7f13\u5b58\u8bbe\u4e3a 0 \u5b57\u8282\n    chrome_options.add_argument(f\"--user-agent={user_agent}\")\n    \n    # \u7981\u6b62\u56fe\u7247\u52a0\u8f7d\n    # prefs = {\"profile.managed_default_content_settings.images\": 2}\n    # chrome_options.add_experimental_option(\"prefs\", prefs)\n    \n    driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=chrome_options)\n    driver.set_window_size(1920, 1080)   # \u8bbe\u7f6e\u5206\u8fa8\u7387 (\u5bbd, \u9ad8)\n    return driver\n\ndef run_chrome(driver, url):\n    try:\n        driver.get(url)\n        # \u7b49\u5f85 body \u5143\u7d20\u52a0\u8f7d\u5b8c\u6210\n        time.sleep(1.5)  # \u7ed9\u6d4f\u89c8\u5668\u7684\u7f51\u9875\u52a0\u8f7d\u7684\u65f6\u95f4\n        WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, 'body')))\n        \n        print(f\"\u6807\u9898: {driver.title}\")\n        print(f\"URL: {driver.current_url}\")\n        # print(f\"\u9875\u9762\u6e90\u7801\u957f\u5ea6: {len(driver.page_source)}\")\n        \n        # \u7f51\u9875\u52a0\u8f7d\u60c5\u51b5\u622a\u56fe\n        driver.save_screenshot(SCREENSHOT_PATH)\n    except Exception as e:\n        print(f\"\u51fa\u9519: {e}\")\n\ndef go2web(driver):\n    try:\n        target_url = random.choice(URL_LIST)\n        run_chrome(driver, target_url)\n    except Exception as e:\n        print(f\"\u8bbf\u95ee\u51fa\u9519: {e}\")\n\nif __name__ == '__main__':\n    user_agent = 'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/135.0.0.0 Safari\/537.36'\n    \n    driver = create_driver(user_agent)\n    \n    try:\n        for i in range(1, 40000000):\n            print(f\"\\n\\n\u7b2c {i} \u6b21\u8bbf\u95ee {getNow()}\")\n            go2web(driver)\n            # time.sleep(1)  # \u53ef\u8c03\u6574\u7b49\u5f85\u65f6\u95f4\n    except KeyboardInterrupt:\n        print(\"\u624b\u52a8\u4e2d\u65ad\")\n    finally:\n        driver.quit()\n<\/pre>\n\n\n\n<p><strong>\u9644\u5f551\u3001\u89c6\u9891\u64cd\u4f5c\u6f14\u793a<\/strong><\/p>\n\n\n\n<p><strong>\u9644\u5f552\u3001@Dasmz<\/strong><\/p>\n\n\n\n<p>\u535a\u5ba2\u5185\uff0c\u6240\u6709\u6559\u7a0b\u4e3a\u624b\u6253\u539f\u521b\u6559\u7a0b\uff0c\u5982\u679c\u6280\u672f\u6559\u7a0b\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff0c\u6b22\u8fce\u6253\u8d4f\u4f5c\u8005\u3002\u6280\u672f\u5c42\u9762\uff0c\u95fb\u9053\u6709\u5148\u540e\uff0c\u5982\u6709\u758f\u6f0f\u3001\u9519\u8bef\uff0c\u6b22\u8fce\u6307\u6b63\u3002\u6280\u672f\u535a\u5ba2\u7684\u5185\u5bb9\uff0c\u4e00\u822c\u5177\u6709\u4e00\u5b9a\u7684\u73af\u5883\u4f9d\u8d56\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u5e74\u4ee3\u4f9d\u8d56\uff0c\u914c\u60c5\u53c2\u8003\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u8bf7\u52ff\u5b8c\u5168\u7167\u642c\u7167\u6284\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u535a\u5ba2\u5185\u5df2\u63d0\u53ca\u7684\u4e13\u4e1a\u77e5\u8bc6\uff0c\u5982\u679c\u9700\u8981\u6280\u672f\u6307\u5bfc\uff0c\u6b22\u8fce\u8054\u7cfb\u6211\uff0c\u4ec5\u9700\u652f\u4ed8\u5de5\u65f6\u8d39<\/p>\n\n\n\n<p>Twitter: <a href=\"https:\/\/x.com\/fdmove\">Dasmz<\/a><\/p>\n\n\n\n<p>Youtube: <a href=\"https:\/\/www.youtube.com\/@DasmzStudio\" data-type=\"URL\" data-id=\"https:\/\/www.youtube.com\/@DasmzStudio\">@DasmzStudio<\/a><\/p>\n\n\n\n<p>Telegram: <a href=\"https:\/\/t.me\/fdmove\" data-type=\"URL\" data-id=\"https:\/\/t.me\/fdmove\">@Dasmz<\/a><\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"574\" height=\"446\" src=\"https:\/\/dasmz.com\/wp-content\/uploads\/2020\/12\/DONATE.jpg\" alt=\"Donate\" class=\"wp-image-18\"\/><figcaption class=\"wp-element-caption\">\u4e91\u4e5e\u8ba8<\/figcaption><\/figure><\/div>","protected":false},"excerpt":{"rendered":"<p>\u524d\u7f00\u3001\u6587\u6863\u4fee\u6539\u8bb0\u5f55 20250509 \u521d\u59cb\u5316\u7f16\u8f91\u6b64\u6587\u7ae0\uff0c\u5b8c\u7a3f \u7ae0\u82821\u3001\u9700\u6c42\u63cf\u8ff0 Debian 12\u7cfb\u7edf\u4e0b\uff0c\u5b89\u88c5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[173,174,172],"_links":{"self":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/4561"}],"collection":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4561"}],"version-history":[{"count":19,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/4561\/revisions"}],"predecessor-version":[{"id":4597,"href":"https:\/\/dasmz.com\/index.php?rest_route=\/wp\/v2\/posts\/4561\/revisions\/4597"}],"wp:attachment":[{"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasmz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}