Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不知道身高的情况下使用python selenium向下滚动?_Python_Reactjs_Selenium Webdriver_Scroll - Fatal编程技术网

如何在不知道身高的情况下使用python selenium向下滚动?

如何在不知道身高的情况下使用python selenium向下滚动?,python,reactjs,selenium-webdriver,scroll,Python,Reactjs,Selenium Webdriver,Scroll,我正在尝试在react项目上使用selenium脚本向下滚动一小段页面 我试过: driver.execute_script("window.scroll(0, 1000);") 以及: 什么也没发生。 在html代码中没有已知的 我通过计算最长div得到页面边界。 在这种情况下是否有可能进行滚动? 或者问题是身体没有高度 其反应页面,因此主体属性为0 谢谢试试: driver.execute_script("window.scrollTo(0, document.body.scrollHei

我正在尝试在react项目上使用selenium脚本向下滚动一小段页面

我试过:

driver.execute_script("window.scroll(0, 1000);")
以及:

什么也没发生。 在html代码中没有已知的 我通过计算最长div得到页面边界。 在这种情况下是否有可能进行滚动? 或者问题是身体没有高度

其反应页面,因此主体属性为0

谢谢

试试:

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
这将滚动到页面底部。

尝试:

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
这将滚动到页面底部