怎么用python爬sf轻小说文库的vip章节小说

Python015

怎么用python爬sf轻小说文库的vip章节小说,第1张

lib下面放一般都是你import的包,其实也可以不用放到lib下面,你就放在你写的.py同一目录下也能import到,但是一般规范都放到Lib下面,对应生成的pyc文件也会在lib都用,这个文件直接拿出来就能用,并且别人没办法看到里面的内容

先在命令行中下载一个selenium库:

1

python -m pip install selenium

然后使用selenium中的webdriver来进行模拟网页点击:

1

2

3

4

5

6

7

8

9

from selenium import webdriver

from selenium.common.exceptions import TimeoutException

from selenium.webdriver.chrome.options import Options

from selenium.webdriver.support.ui import Select

from selenium.webdriver.support.ui import WebDriverWait

sel=webdriver.Chrome() #也可换成Ie(),Firefox()等

element=sel.find_element() #在网页源码中查找元素

element.click() #模拟对元素进行点击

如果你是Chrome用户,需要手动下载一个chromedriver.exe,这里附上,把它放入系统Path路径任意一个文件夹中即可