python学习之——splinter使用

it2022-05-05  127

 

开始学习使用splinter工具了,目前是摸索中,先熟悉splinter工具的使用方法~~

实现功能:

打开firefox浏览器->www.baidu.com->输入关键词 python,进行搜索~~

from splinter import Browser import time def main(): browser = Browser() browser.visit('http://baidu.com') browser.fill('wd', 'python') button = browser.find_by_id("su") button.click() if __name__ == '__main__': main()

关键点:

1、熟悉splinter工具的语法;

2、得到网址中需要操作的elements,可使用value、id、name等,通过查看网页源代码获得;

3、默认打开的浏览器是firefox,网上介绍说使用其他浏览器,需要安装对应的驱动,以后学习;

 

后记:部门重心调整,各种充电中,技术决定一切,牢记工作前三年的重要性~~

转载于:https://www.cnblogs.com/cloverclt/p/5661045.html


最新回复(0)