Update all headless mode v4

master
joey0629 12 months ago
parent 086f3361ff
commit 3107f216ec
  1. 12
      Test_forbidden.py
  2. 2
      main.py

@ -0,0 +1,12 @@
import requests
url = "https://www.bea.gov/news/2024/personal-income-and-outlays-february-2024" # 請將這裡替換為你的網址
response = requests.get(url)
if response.status_code == 200:
print("Successfully accessed the website.")
elif response.status_code == 403:
print("Your IP is forbidden to access this website.")
else:
print(f"Received status code {response.status_code}.")

@ -78,7 +78,7 @@ def find_pce(date:str):
from selenium.webdriver.chrome.options import Options
print("Start")
options = Options()
options.add_argument('--headless')
# options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--window-size=1920,1080") # 可以根據需要調整這個大小

Loading…
Cancel
Save