python+selenium browser call (chrome, ie, firefox)

#coding=utf-8

from selenium import webdriver

#driver=webdriver.Ie() #Call ie browser
#driver=webdriver.Firefox() #Call firefox browser

driver=webdriver.Chrome() #Call chrome browser

driver. get('https://www.baidu.com')

print driver.title#Output title

driver.quit()#Close the driver

1 To run the script under chrome, you need to put chromedriver.exe in the chrome browser installation directory

( At the same time, set the user environment variable path:C:\Users\xxxxxx\AppData\Local\Google\Chrome\Application;)

2 To run the script under ie, you need to put IEDriverServer.exe in the IE browser installation directory

(set the user environment at the same time) Variable path: C:\Program Files\Internet Explorer )

3 Run the script under firefox and call it directly (under the default installation path)

Reference: http://www.cnblogs.com/nzyjlr/p/4377663.html

---- --------------------Personal source code
# coding=utf-8
'''
Created on 2017年2月20日

@author: chenkai
'''
from selenium import webdriver

driver=webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")  #调用chrome浏览器
driver.get('http://www.ijiami.cn/')
print driver.title

#driver.quit()

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326666374&siteId=291194637