详细描述:想用ie浏览器来执行测试用例,按照官方文档http://code.google.com/p/selenium/wiki/IEDriver 的步骤操作后还是报WebDriverException: Message: 'IEDriverServer.exe' executable needs to be in PATH的错,配了系统环境变量重启后也没用。
用下面这种方法设环境变量就可以:
import os from selenium import webdriver iedriver = "F:MySoftwareIEDriverServer_x64_3.141.0IEDriverServer.exe" os.environ["webdriver.ie.driver"] = iedriver driver = webdriver.Ie(iedriver) #driver = webdriver.Ie() driver.get('https://www.baidu.com/')