测试积点老人 发表于 2018-12-18 15:34:09

Mac配置selenium3自动化测试环境

系统环境 mac python3.6 pip instal selenium #安装selenium模块,默认是最新的ye可以pip instal selenium==版本号brew install geckodriver #下载安装geckodriver或者直接去selenium官网下载https://github.com/mozilla/geckodriver/releasesgeckodriver-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()

页: [1]
查看完整版本: Mac配置selenium3自动化测试环境