擅长:python、mysql、java
<p>我只是尝试了这种方法,它对我起了作用:</p>
<pre><code>element = driver.find_element_by_xpath("//div[@class='center-content']")
driver.execute_script("return arguments[0].scrollIntoView(0, document.documentElement.scrollHeight-10);", element)
</code></pre>
<p>首先选择要向下滚动的页面的<code>div</code>元素,然后在该元素中向下滚动。</p>
<p>OBS:我在定义scrollHeight时添加了偏移量,因为如果滚动到绝对底部,它不会加载更多对象。当您靠近底部而未触及目录时,它将开始加载目录。</p>
<pre><code>document.documentElement.scrollHeight-10
</code></pre>