selenium - Selenium 对特定页面返回空白,但适用于其他页面
问题描述
我是 selenium 新手,我想用 selenium 爬取这个网站 http://www.customs.gov.cn/customs/302249/index.html,但是我得到一个这样的空白页面。但是当我尝试获取http://www.customs.gov.cn时,它可能会返回正确的结果。我不认为这是硒的问题,我搜索了很多,但不知道为什么,你能帮我吗?谢谢。这是我的代码:
from selenium import webdriver # selenium import webdriver
import time
url = 'http://www.customs.gov.cn/customs/302249/index.html'
driver = webdriver.Chrome() # 声明调用Chrome
driver.get(url) #
解决方案
请确保网址http://www.customs.gov.cn/customs/302249/index.html在 chrome 中以隐身窗口打开,然后重试。该网址对我不起作用。向客户报告空白页。您可能会看到页面的缓存版本。CTRL + F5 也将帮助您获得页面的新副本。
请记住,Selenium 只是要求浏览器打开一个页面。它不会打开页面本身。
推荐阅读
- vagrant - 如何使用 Vagrant 2.2.6 安装 vagrant-winnfsd v1.3.1 插件?
- python - Python:测试和设置不运行
- java - 在 GetRequest 中使用 2 个参数的 SQL 查询
- android - 如何在屏幕上按比例显示 4 个图像
- scikit-learn - 如何正确拟合 MultiLabelBinarizer?
- c# - 检索 Azure DevOps REST API 5.1 的访问令牌
- node.js - 如何使用 Mocha 为具有 async await 和 try catch 的函数编写适当的测试?
- cron - 每 13 天计划触发 Azure 管道
- mysql - Couldn't get the exact set of data from multiple tables when i write a mysql query
- javascript - 如何使用 Javascript 或 Lodash 搜索嵌套对象数组