‘’’’
@Project: DemoUI-master
@Description: Remote用法
@Time:2021/12/28 12:49
@Author:MING
‘’’
注意:
1.使用Remote前首先得确认自己的电脑是否有Java环境
2.安装了Java环境后,下载selenium-server-standalone-3.13.0.jar (下载地址:http://selenium-release.storage.googleapis.com/index.html)
3.打开CDM,将路径切换到包的文件夹内并运行java -jar selenium-server-standalone-3.13.0.jar命令
4.命令:java -jar selenium-server-standalone-3.13.0.jar
import time
from selenium.webdriver import Remote, DesiredCapabilities
from selenium.webdriver.common.by import By
driver = Remote(command_executor=‘http://127.0.0.1:4444/wd/hub’,
desired_capabilities=DesiredCapabilities.CHROME)
driver.get(“https://www.baidu.com”)
driver.find_element(By.ID,“kw”).send_keys(“苹果”)
driver.find_element(By.ID,“su”).click()
time.sleep(5)
print(driver.title)
driver.quit()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)