Google Colab Selenium
1.0.0

การใช้งานขั้นพื้นฐาน:
%pip install google-colab-seleniumใช้เวอร์ชันที่ตรวจพบไม่ได้:
%pip install google-colab-selenium[undetected] import google_colab_selenium as gs
driver = gs . Chrome ()
# Your code to interact with the driver here
# ...
driver . quit () import google_colab_selenium as gs
driver = gs . UndetectedChrome ()
# Your code to interact with the driver here
# ...
driver . quit () แพ็คเกจ google-colab-selenium ได้รับการกำหนดค่าล่วงหน้าด้วยชุดตัวเลือกเริ่มต้นที่ได้รับการปรับให้เหมาะสมสำหรับสภาพแวดล้อมของ Google Colab ค่าเริ่มต้นเหล่านี้รวมถึง:
--headless : รันโครเมี่ยมในโหมดหัวขาด (ไม่มี GUI)--no-sandbox : ปิดใช้งานคุณสมบัติ Chrome Sandboxing ซึ่งจำเป็นในสภาพแวดล้อม colab--disable-dev-shm-usage : ป้องกันปัญหาด้วยหน่วยความจำที่ใช้ร่วมกัน จำกัด ในคอนเทนเนอร์ Docker--lang=en : ตั้งค่าภาษาเป็นภาษาอังกฤษคุณสามารถขยายหรือแทนที่ตัวเลือกเหล่านี้ตามความต้องการของคุณ:
from selenium . webdriver . chrome . options import Options
import google_colab_selenium as gs
custom_options = Options ()
# Add your custom options here
driver = gs . Chrome ( options = custom_options )ยินดีต้อนรับ! หากคุณมีข้อเสนอแนะหรือปัญหาโปรดใช้ตัวติดตามปัญหาเพื่อแจ้งให้เราทราบ