mac selenium php,Mac配置selenium3自动化测试环境
发布日期:2021-06-24 13:10:45 浏览次数:2 分类:技术文章

本文共 948 字,大约阅读时间需要 3 分钟。

系统环境 mac python3.6

pip instal selenium #安装selenium模块,默认是最新的ye可以pip instal selenium==版本号

brew install geckodriver #下载安装geckodriver

或者直接去selenium官网下载https://github.com/mozilla/geckodriver/releases

geckodriver-v0.20.0-macos.tar.gz解压到指定目录,或者配置到python环境中/usr/local/bin。

Firefox浏览器版本59.0.2

报错

elenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH,是因为geckodriver的没有在环境变量中识别到

报错

selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities是因为浏览器的版本和驱动的版本不一致

测试一下

#!/usr/bin/env python

# -*- coding: UTF-8 -*-

from selenium import webdriver

import time

#driver = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")

driver = webdriver.Firefox(executable_path="/Users/wang/Downloads/geckodriver")

driver.get("http://www.baidu.com")

driver.find_element_by_id("kw").send_keys("测试")

driver.find_element_by_id("su").click()

time.sleep(30)

driver.quit()

ok

转载地址:https://blog.csdn.net/weixin_33001305/article/details/115726565 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:php盲注漏洞修复,织梦dedecms注入漏洞pm.php修复方法
下一篇:imagemagick+php版本,php版本 5.2.14 按照论坛里搜的imagemagick教程安装不成功

发表评论

最新留言

不错!
[***.144.177.141]2024年04月14日 07时49分18秒