我试着为一个被动态加载的网站做网页抓取,我今天试着关闭弹出图标或者点击“不谢谢”,但是它不起作用,我在屏幕截图中显示错误。
我需要获取产品名称,新的和旧的价格和他们的href图像URL在excel中。
Option Explicit
Private cd As Selenium.ChromeDriver
Sub Findingelement()
Set cd = New Selenium.ChromeDriver
cd.Start
cd.Get "https://www.westelm.com/shop/furniture/all-living-room/?cm_ty
我正在使用selenium抓取一个动态页面,在下面的示例中,我在获取文本1和text 2时遇到了困难:
<span class="class number 1"> text 1 <a href="link 1"> text 2 </a> </span>
如果跨度为div,也会发生同样的情况。
我设法用这个python行获得了文本1。
var = driver.find_element(By.CLASS_NAME, "class number 1").text"
但是,要获得文本2,因为链接
目前,我正试图在整个网页中获取一些文本数据。一开始,我抓取所有的网页,然后慢慢地在网页中筛选,从每一页抓取我需要的数据。例如,由于动态ID的原因,我在抓取诸如平方英尺或邻居之类的项目时遇到了困难。我通过XPath或CSS选择器看到的许多例子都涉及到搜索文本,但在我试图抓取的每一页上都会发生变化。有什么办法能捕捉到这片土地或社区吗?
from bs4 import BeautifulSoup
from selenium import webdriver as wd
from selenium.common.exceptions import StaleElementReferenceExcep
我需要一个网络抓取专家的帮助。我试图从这个网站的视频标签中获得src。当我试图使用selenium或beautifulsoup4来捕获它时,它似乎不存在。find_elements返回一个空列表。这个“//*@id=”player“/div2 2/div2 3/video”是safari中检查元素中该元素的XPATH。我可以在检查网页时看到它,但我不能刮它。我也尝试过使用find_element("src")方法,但没有成功。它抛出一个异常,表示没有找到这样的元素。
这是我的密码:
from selenium import webdriver
from selenium.web
我正在尝试使用Selenium或BeautifulSoup4从https://www.finishline.com中抓取数据。到目前为止,我还没有成功,所以我向Stackoverflow寻求帮助--希望有人知道如何绕过他们的抓取保护。 我试过使用Beautifulthon4和Selenium。下面是一些简单的例子。 在我的主程序中使用的常规导入: import requests
import csv
import io
import os
import re
from selenium import webdriver
from selenium.webdriver.common.keys
我正试着从大学网站上的职业网页上抓取链接,而我却得到了这个错误。
urllib.error.HTTPError: HTTP 302: HTTP返回一个重定向错误,这将导致无限循环。最后30x错误消息是:临时移动
我认为这是因为该网站有一个会话cookie。在阅读了一段时间之后,似乎有很多方法可以解决这个问题(请求、http.cookiejar、Selenium/PhantomJ),但我不知道如何将这些解决方案合并到我的刮取程序中。
这是我的刮擦程序。它是用Python3.6与BeautifulSoup4编写的。
from bs4 import BeautifulSoup
from ur
我正在尝试使用Selenium从动态加载的表中抓取。
因为它是由javascript动态加载的,所以我需要使用Webdriverwait,但是我一直在使用
超时异常错误
我的代码如下:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.supp
我想从网站上抓取数据。
我正在尝试访问每个博客,然后点击链接,在给定博客的详细信息页上刮取详细信息。
我尝试使用BeautifulSoup,但它没有返回任何数据,并且我意识到数据是用JavaScript动态加载的。
然后我尝试使用Selenium来刮掉它,这是我想出的代码:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
service = Service('/usr/bin/chromedrivers')
service.start()
drive
我正在学习python中的网络爬行和抓取。我想要抓取数据,在一个网站上有链接,而在这些链接里面有更多的链接。所以我想抓取数据直到预定义的级别n。这是我的基本代码 import requests
from selenium import webdriver
from requests_ntlm import HttpNtlmAuth
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from bs4 import BeautifulSoup
from
我正在尝试学习使用python进行数据抓取,并且一直在使用请求和BeautifulSoup4库。它适用于普通的html网站。但是当我试图从那些延迟加载数据的网站获取一些数据时,我发现我得到了一个空值。一个例子就是
from bs4 import BeautifulSoup
from operator import itemgetter
from selenium import webdriver
url = "https://www.example.com/;1"
browser = webdriver.PhantomJS()
browser.get(url)
html = b
我正在使用selenium抓取一个网页。我首先找到我想要的链接,然后点击并下载(链接是pdf)。有时我可以这样做,但有时selenium说没有找到链接。我认为这是由于页面加载不正确所致。对此我能做些什么,我是否在正确的方向上?
这是我以前的代码:
for b in source_code_2.find_all('a', href=True):
if b.has_attr("title"):
if(b['title']=='Click here to download'):
urlli