标签:
转载自:http://www.cnblogs.com/fnng/archive/2013/05/29/3106515.html
在eclipse中输入以下代码:
#!/usr/bin/env python
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
#chrome download url: http://www.xdowns.com/soft/xdowns2009.asp?softid=136971&downid=10&id=138354
#路径要具体到chrome driver exe文件
#否则会出现错误:selenium.common.exceptions.WebDriverException: Message: ‘ChromeDriver executable needs to be available in the path.
chrome_driver_path = "C:\Python27\selenium\webdriver\chromedriver\chromedriver"
driver = webdriver.Chrome(chrome_driver_path)
driver.get("http://baidu.com")
执行代码,可以看到:
百度的网页在chrome中打开。
[code] python+selenium实现打开一个网页
标签:
原文地址:http://www.cnblogs.com/sophia194910/p/4860641.html