小编hiM*_*Mom的帖子

如何使用 Selenium 在 Instagram 弹出框架中向下滚动

我有一个 python 脚本,使用 selenium 转到给定的 Instagram 个人资料并遍历用户的关注者。在 Instagram 网站上,当单击查看关注者列表时,会弹出一个列出帐户的弹出窗口(这是该网站的屏幕截图

然而,无论是在视觉上还是在 html 中,都只显示了 12 个帐户。为了看到更多,必须向下滚动,所以我尝试使用 Keys.PAGE_DOWN 输入来执行此操作。

from selenium import webdriver
from selenium.common.exceptions         import TimeoutException
from selenium.webdriver.support.ui      import WebDriverWait 
from selenium.webdriver.support         import expected_conditions as EC
from selenium.webdriver.chrome.options  import Options
from selenium.webdriver.common.keys     import Keys
import time 
Run Code Online (Sandbox Code Playgroud)

...

username = 'Username'
password = 'Password'
message  = 'blahblah'
tryTime  = 2

#create driver and log in
driver = webdriver.Chrome()
logIn(driver, username, password, tryTime)

#gets rid of preference pop-up
a = driver.find_elements_by_class_name("HoLwm")
a[0].click() …
Run Code Online (Sandbox Code Playgroud)

python selenium webautomation instagram

4
推荐指数
1
解决办法
6361
查看次数

标签 统计

instagram ×1

python ×1

selenium ×1

webautomation ×1