
6

Python爬虫编程思想(111):基于Splash的爬虫--使用CSS选择器
source link: https://blog.csdn.net/nokiaguy/article/details/122418852
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Splash Lua支持CSS选择器,这些选择器也需要通过一些方法使用,本节将介绍与CSS选择器相关的函数。
1. select函数
该函数用于查找第1个符合条件的节点,如果有多个节点符合条件,只会返回第1个符合条件的节点。select方法的参数是CSS选择器。
下面的例子使用select方法查找京东商城首页搜索框节点,并输入搜索关键字。
运行结果如图1所示。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK