Skip to content

Commit

Permalink
Docker Support
Browse files Browse the repository at this point in the history
  • Loading branch information
NaiboWang committed Apr 23, 2024
1 parent ad568af commit 818d3e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ExecuteStage/easyspider_executestage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from pynput.keyboard import Key, Listener
from datetime import datetime
import io # 遇到错误退出时应执行的代码
import json
Expand Down Expand Up @@ -2450,6 +2449,9 @@ def getData(self, param, loopElement, isInLoop=True, parentPath="", index=0):
else:
print("Using remote driver")
# Use docker driver, default address is http://localhost:4444/wd/hub
# Headless mode
options.add_argument("--headless")
print("Headless mode")
browser_t = MyChrome(command_executor=c.docker_driver, options=options, mode='remote_driver')
elif browser == "edge":
from selenium.webdriver.edge.service import Service as EdgeService
Expand Down Expand Up @@ -2511,6 +2513,7 @@ def getData(self, param, loopElement, isInLoop=True, parentPath="", index=0):
# print("Passing the Cloudflare verification mode is sometimes unstable. If the verification fails, you need to try again every few minutes, or you can change to a new user information folder and then execute the task.")
# 使用监听器监听键盘输入
try:
from pynput.keyboard import Key, Listener
if c.keyboard:
with Listener(on_press=on_press_creator(press_time, event),
on_release=on_release_creator(event, press_time)) as listener:
Expand Down

0 comments on commit 818d3e0

Please sign in to comment.