admin管理员组文章数量:1534367
环境配置前提,见文章https://mp.csdn/mp_blog/creation/editor/new?spm=1001.2101.3001.4503
下载360浏览器,并下载对应版本的chromedriver.exe,下载地址http://chromedriver.storage.googleapis/index.html
下载好360浏览器,将chromedriver.exe放在D:\Python\Python311\chromedriver.exe,以便使用
以下是使用360浏览器实现selenium自动化的前提
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdrivermon.by import By
import time
options=webdriver.ChromeOptions()
options.binary_location=r'D:\Program Files\360\360se6\Application\360se.exe'#360浏览器安装地址
service=Service(r'D:\Python\Python311\chromedriver.exe')#谷歌浏览器chromedriver.exe地址
driver=webdriver.Chrome(service=service,options=options)#需要定义Service,否则会报错
driver.get("http://198.23.23.33:9020/")
driver.find_element(by=By.ID,value='USERID').send_keys("406149")
driver.find_element(by=By.ID,value='PASSWORD_VIEW').send_keys("222222")
time.sleep(3000)
driver.close()
注意:
Traceback (most recent call last):
File "C:\Users\ogin.py", line 2, in <module>
driver =webdriver.Chrome();https://registry.npmmirror/binary.html?path=chromedriver/
如果执行过程中报以上错误,有可能是chromedriver.exe不兼容问题,下载对应的chromedriver.exe即可,地址见第2步
版权声明:本文标题:IDEA+Python+Selenium+360浏览器自动化测试 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1726883016a1088673.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论