selenium setup

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()
全部评论

相关推荐

東大沒有派對:这是好事啊(峰哥脸
我的秋招日记
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务