test-selenium.py 646 B

12345678910111213141516171819202122
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. '''
  4. @Auther :liuyuqi.gov@msn.cn
  5. @Time :2018/4/11 15:31
  6. @File :test-phantomjs.py
  7. '''
  8. from splinter import Browser
  9. browser=Browser("phantomjs",executable_path="D:/Program-Files/phantomjs-2.1.1-windows/bin/phantomjs.exe")
  10. url="http://blog.yoqi.me/archives/4395"
  11. browser.visit(url=url)
  12. # browser.find_by_xpath()
  13. # browser.find_by_css()
  14. # browser.find_by_id()
  15. # browser.find_link_by_text()
  16. # browser.fill("q","splinter - python acceptance testing for web applications")
  17. # button=browser.find_by_name("btnG")
  18. # button.click()
  19. browser.driver.set_window_size(1366, 768)
  20. print("页面标题",browser.title)