我使用Selenium和Python从this网站中提取医生列表。我选择选项专业并提取结果。一旦我们在twitter feed中滚动页面,结果就会显示出来。我无法滚动页面查看结果。我试着像send_keys为多种办法:正如我不知道我需要多长时间才能DOWN按钮按下PAGE使用Selenium Python滚动到底部
for i in range(0,15):
self.driver.find_element_by_id("doctor-matrix-section").send_keys(Keys.PAGE_DOWN)
time.sleep(1)
print 'hello'
print i
i+= 1
循环使用。 我也尝试另一种方法为:该方法的
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
无我也跟着工作。任何帮助都会非常有用。
你试过 - 'driver.execute_script(“window.scrollBy(0,document.body.scrollHeight);”)'?当你在网页上有特定的坐标时使用scrollTo。 scrollBy按照像'document.body.scrollHeight'这样的像素数来滚动。 –
我试过了,但根本没有工作,该网站使用angularjs开发,无论如何会影响? –