5

Python爬虫编程思想(60): 通过浏览器获取CSS选择器代码

 2 years ago
source link: https://blog.csdn.net/nokiaguy/article/details/121044007
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.
neoserver,ios ssh client

Python爬虫编程思想(60): 通过浏览器获取CSS选择器代码

        CSS选择器并不总是需要手工编写,通过浏览器可以轻松获得任何节点的CSS选择器代码。本节将以Chrome浏览器为例讲解如何通过Chrome浏览器获取CSS选择器代码。

        以京东商城(https://www.jd.com)为例,在京东商城首页,单击右键菜单中的“检查”菜单项,会显示开发者工具,在Elements选项卡中定位到要获取CSS选择器代码的节点,如获取京东商城首页的“秒杀”链接的CSS选择器,可以单击对应的a节点,然后在右键菜单中单击Copy>Copy selector菜单项,如图1所示。就会将该节点的CSS选择器复制到剪贴板上。

复制的结果如下:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK