在Instagram框中向下滚动关注者/关注列表 [英] Scroll down Followers/Following List in the Instagram Box

查看:146
本文介绍了在Instagram框中向下滚动关注者/关注列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好:)我正在寻找一种解决方案,用于在Instagram框中向下滚动以下/关注者列表. 我要做的步骤如下:

Hi :) I was looking for a solution to scroll down the following/followers list in the Instagram Box. The step I do are the following:

  • 打开用户A的IG配置文件;
  • 点击关注者"按钮;
  • IG框中会出现一个包含12个关注者的列表的框.

显示跟随者列表后,当我使用以下一行向下滚动时:

Once the followers list is shown up, when I scroll down using the line:

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

我知道该框下方的页面向下滚动:(

I get that the page below the box scrolls down :(

如何在关注者框中向下滚动列表?

How can scroll down the list in the followers box?

先谢谢您了:) 玛丽亚.

Thanks in advance :) Maria.

推荐答案

如果不同的类,您可以尝试execute_script()并更改.isgrP

you can try execute_script() and change .isgrP if different class

...
from selenium.webdriver.support.ui import WebDriverWait 
.....
# after click follower link, wait until dialog appear
WebDriverWait(driver, 10).until(lambda d: d.find_element_by_css_selector('div[role="dialog"]'))
# now scroll
driver.execute_script('''
    var fDialog = document.querySelector('div[role="dialog"] .isgrP');
    fDialog.scrollTop = fDialog.scrollHeight
''')

这篇关于在Instagram框中向下滚动关注者/关注列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆