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)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)