You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac环境下无需安装Microsoft Edge能否通过Selenium运行?

Can I Write Selenium Scripts for Edge Without Installing the Edge DMG?

Hey there! Great question—you absolutely can run Selenium scripts targeting Edge without installing the full Edge DMG package, which is perfect for saving storage space. Here are the practical ways to make this work for your Bing Rewards + Airflow project:

1. Use a Portable/Unpacked Edge Build

Instead of installing the official DMG, grab a portable version of Edge (no installation required—just unzip and run). This lets you point Selenium directly to the browser binary without modifying your system's installed apps.

Example Python Script:

from selenium import webdriver
from selenium.webdriver.edge.options import Options

# Configure Edge options
edge_options = Options()
# Point to your portable Edge binary path (adjust this to your actual file location)
edge_options.binary_location = "/Users/you/path/to/portable-edge/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
# Enable headless mode (critical for Airflow background execution—no browser window pops up)
edge_options.add_argument("--headless=new")
# Add resource-saving flags
edge_options.add_argument("--disable-gpu")
edge_options.add_argument("--no-sandbox")
edge_options.add_argument("--disable-dev-shm-usage")

# Initialize the driver
driver = webdriver.Edge(options=edge_options)

# Your Bing Rewards automation logic here
driver.get("https://www.bing.com")
# ... rest of your script ...

# Clean up
driver.quit()

2. Key Compatibility Note

Make sure the version of Edge WebDriver you download matches exactly with your portable Edge build. To check Edge's version:

  • Run this command in your terminal:
    "/Users/you/path/to/portable-edge/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" --version
    
  • Grab the corresponding WebDriver, extract the msedgedriver binary, and place it in a path accessible by your Airflow worker (no installation needed).

3. Airflow-Specific Tips

  • Store the portable Edge folder and WebDriver binary in a location your Airflow workers can access (e.g., a shared directory or a path defined in your Airflow PATH environment variable).
  • Avoid relative paths in your script—use absolute paths to prevent file not found errors when Airflow runs the task.

This approach not only saves storage but also runs efficiently in Airflow's headless environment, making it ideal for automated Bing Rewards tasks.

内容的提问来源于stack exchange,提问作者Flash Gordon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:35:02