Logo
Section 1 / 11

Selenium 简介

熟悉 Selenium 无头浏览器并了解其功能。

导入

Selenium 简介

熟悉 Selenium 无头浏览器并了解其功能。

...
点击触发的JS函数,展示表格中的电影信息
...
Selenium在数据抓取中的作用
...
Selenium工作流程
1# 可以使用任意版本 2FROM python:3.8 3 4RUN apt-get update && apt-get install -y --no-install-recommends wget gnupg curl 5# 添加Chrome软件源 6RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - 7RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' 8 9RUN apt-get update && apt-get install -y --no-install-recommends gcc libc-dev libmagic-dev unzip google-chrome-stable 10RUN rm -rf /var/lib/apt/lists/* 11RUN apt-get clean 12 13# 安装chromedriver 14RUN DRIVER_VERSION=$(curl -sL http://chromedriver.storage.googleapis.com/LATEST_RELEASE) 15RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sL http://chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip 16RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ 17 18# 设置显示端口以避免Chrome崩溃 19ENV DISPLAY=:99

No configuration found for ID: ba304a6c9390f3374e861ddfbafdc63bbabc5d432ca31f0e58a4d03cb6f70d63

No configuration found for ID: 4cc1302325985f45fb95b8d09936fadd07a799bbc9e0acd3bc9960513ffbbcd7

Scrapy 框架

隐式等待与显式等待