参考于手册
chrome驱动下载: https://chromedriver.duq.googleapis.com/index.html?path=2.27/
firefox驱动: https://github.com/mozilla/geckodriver/releases
from splinter import Browser
def main():
executable_path = {'executable_path': r'C:\Users\bzhux\Program\chromedriver_win32\chromedriver.exe'}
#browser = Browser('firefox')
browser = Browser('chrome')
#browser = Browser('chrome', **executable_path)
browser.visit('http://www.baidu.com')
browser.fill('wd', 'python')
button = browser.find_by_id('su')
button.click()
if browser.is_text_present('Welcome to Python.org'):
print 'yes, the official website was found!'
else:
print "No, it wasn't found... We need o improve our SEO techniques"
browser.quit()
if __name__ == '__main__':
main()
这个Beautiful Soup可以用来操作html