【发布时间】:2021-05-13 19:38:47
【问题描述】:
我很尴尬,因为我没有在 instagram 的模式上滚动。而不是它滚动背面的页面:(
我已经尝试过browser.execute_script("arguments[0].scrollTop = arguments[0].scrollHeight", modalDiv) ...我尝试过我创建的任何东西,但仍然无法正常工作。
我的代码:
browser.get('https://www.instagram.com/%s' % account)
sleep(2)
clickToFollowing= browser.find_element_by_xpath("/html/body/div[1]/section/main/div/header/section/ul/li[3]/a/span")
clickToFollowing.click()
actionChain = webdriver.ActionChains(browser)
time.sleep(2)
modalDiv= browser.find_elements_by_xpath("//html/body/div[5]/div/div/div[2]/div/div/div[4]/div[2]/div[2]")
browser.execute_script("window.scrollBy(0, 660);")
【问题讨论】:
-
查看 iframe
-
@cruisepandey 我怎么能做到这一点??
-
您不必制作它们,只是您必须在开发人员工具 (F12) 中确定元素是否在 iframe 内,如果是,则必须切换到该框架以便进行交互
标签: python selenium scroll instagram