seleniumpython无法向下滚动

seleniumpython无法向下滚动,第1张

seleniumpython无法向下滚动

您可以尝试以下move_up和move_down函数

driver.maximize_window()driver.get('https://www.woolworths.com.au/Shop/Browse/back-to-school/free-school-labels')driver.implicitly_wait(15)centerPanel = driver.find_element_by_css_selector("#center-panel > div[class*='hideScroll-wrapper']")jsscript = """        function move_up(element) { element.scrollTop = element.scrollTop - 1000;        }        function move_down(element) { element.scrollTop = element.scrollTop + 1000;        }        move_down(arguments[0]);        move_down(arguments[0]);        """driver.execute_script(jsscript, centerPanel)time.sleep(3)jsscript = """        function move_up(element) { element.scrollTop = element.scrollTop - 1000;        }        function move_down(element) { console.log('Position before: ' + element.scrollTop); element.scrollTop = element.scrollTop + 1000; console.log('Position after: ' + element.scrollTop);        }        move_up(arguments[0]);        """driver.execute_script(jsscript, centerPanel)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5462795.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存