1.安装selenium grid https://hub.docker.com/r/selenium/standalone-chrome

2.py测试脚本

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import os
import time

url = "https://www.google.com"
keyword = "test"

driver = webdriver.Remote(
    command_executor = "http://localhost:4444/wd/hub",
    options = webdriver.ChromeOptions()
)

driver.implicitly_wait(10)

driver.get(url)
driver.find_element(By.NAME, "q").send_keys(keyword + Keys.RETURN)

time.sleep(5)
driver.quit()