我正在尝试使用selenium webdriver从youtube搜索中抓取标题和链接,目前我正在迭代这个过程,直到某个条件变为false。虽然我可以看到页面在启动时正在滚动,但我得到的数据似乎只来自第一个页面,然后才滚动一次。向下滚动后如何访问更新后的数据?
这是我的一些代码:
driver.get(URL)
while (condition)
// extract data, check for condition and write to csv file
driver.execute_script("window.scrollTo(0, 10000)")
WebDriv
希望你是好的,我试着做一个简单的脚本,但我被困在那里,我试图滚动列表得到更多,但我无法向下滚动。谁知道这是怎么回事。
这是我的代码:
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from shutil import which
import time
import pandas as pd
import json
# from fake_useragent import UserAgent
from selenium.webdriver.
我试图使用selenium向下滚动google地图页面,但无法这样做。我试过这里写的所有东西:
这是我的代码:
def scroll(self):
SCROLL_PAUSE_TIME = 5
# Get scroll height
last_height = self.execute_script("return document.body.scrollHeight")
number = 0
while True:
number = number+1
# Scroll down t
我的代码可以抓取youtube视频的标题,但不能向下滚动来抓取所有标题。 当selenium打开浏览器时,它甚至根本不会滚动。如何修改代码以无限向下滚动并最终抓取所有标题。 import time
from selenium import webdriver
from bs4 import BeautifulSoup
import requests
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.s
我用python结合selenium编写了一些代码,可以从网页中解析不同的产品名称。如果使浏览器向下滚动,则很少有加载更多按钮可见。如果页面被设置为向下滚动,直到没有加载更多按钮可点击,则网页会显示其全部内容。我的刮刀似乎做得很好,但我没有得到所有的结果。在那个页面上大约有200个产品,但我得到了90个。我应该在我的刮板中做些什么改变才能得到它们呢?提前谢谢。
我正在处理的网页:
这是我正在尝试使用的脚本:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from se
我试着从这个网页上刮掉所有5000家公司。当我向下滚动时,它的动态页面和公司都会被加载。但是我只能刮掉5公司,那么我怎么才能刮掉所有的5000家呢? URL正在改变,因为我向下滚动页面。我试过硒但不起作用。注:我想刮公司的所有信息,但现在选择了两个。
import time
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
from selenium import webdriver
from selenium.webdriver.chrome.options import Opti
我编写了一个脚本,使用python和selenium相结合,从一个网页中获取所有的公司链接,直到向下滚动才会显示所有的链接。然而,当我运行我的脚本时,我得到了想要的链接,但是有很多重复的东西被刮走了。此时,我不知道如何修改我的脚本以获得唯一的链接。以下是我迄今尝试过的:
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('http://fortune.com/fortune500/list/')
while True:
driver.execute_scri
我目前正在尝试使用一定数量的像素在selenium C#中向下滚动。我该怎么做呢? 我的最后一个项目,我有一个在python中工作的产品,但这是我切换到C#后遇到的唯一问题。我不知道如何按像素量滚动。 在Python中,我能够做到: pyautogui.scroll(-132) 它会在屏幕上向下滚动132个像素。 但是,我在C#中使用selenium,不知道如何在C#中做到这一点。 picture of scroll bar which is inside the page THIS IS THE IMAGE OF THE INSPECT ELEMENT OF THE SCROLL BAR