Alo*_*mya 2 javascript python selenium
想要在 web.whatsapp.com 中滚动聊天。分享了下面的伪代码:
recentList = driver.find_elements_by_xpath("//div[@class='_2wP_Y']")
driver.execute_script("window.scrollTo(0, 500);")
Run Code Online (Sandbox Code Playgroud)
期待解决方案,以便在 web.whatsapp.com 中进行搜索直到最后一次聊天。
提前致谢!
小智 5
试试下面的代码
recentList = driver.find_elements_by_xpath("//div[@class='_2wP_Y']")
for list in recentList :
driver.execute_script("arguments[0].scrollIntoView();", list )
// other operation
Run Code Online (Sandbox Code Playgroud)