Skip to content

Commit 818d3e0

Browse files
committed
Docker Support
1 parent ad568af commit 818d3e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ExecuteStage/easyspider_executestage.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from selenium.webdriver.common.keys import Keys
3232
from selenium.webdriver.chrome.options import Options
3333
from selenium.webdriver.chrome.service import Service
34-
from pynput.keyboard import Key, Listener
3534
from datetime import datetime
3635
import io # 遇到错误退出时应执行的代码
3736
import json
@@ -2450,6 +2449,9 @@ def getData(self, param, loopElement, isInLoop=True, parentPath="", index=0):
24502449
else:
24512450
print("Using remote driver")
24522451
# Use docker driver, default address is http://localhost:4444/wd/hub
2452+
# Headless mode
2453+
options.add_argument("--headless")
2454+
print("Headless mode")
24532455
browser_t = MyChrome(command_executor=c.docker_driver, options=options, mode='remote_driver')
24542456
elif browser == "edge":
24552457
from selenium.webdriver.edge.service import Service as EdgeService
@@ -2511,6 +2513,7 @@ def getData(self, param, loopElement, isInLoop=True, parentPath="", index=0):
25112513
# 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.")
25122514
# 使用监听器监听键盘输入
25132515
try:
2516+
from pynput.keyboard import Key, Listener
25142517
if c.keyboard:
25152518
with Listener(on_press=on_press_creator(press_time, event),
25162519
on_release=on_release_creator(event, press_time)) as listener:

0 commit comments

Comments
 (0)