有几种方法可以向下滚动到页面底部。根据URL
https://silpo.ua/offers/?categoryId=13, 版权
信息位于页面底部。因此,您可以使用
scrollIntoView()方法在视口中滚动
版权 消息,如下所示:
from selenium import webdriverfrom selenium.webdriver.chrome.options import Optionsfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support import expected_conditions as ECURL = "https://silpo.ua/offers/?categoryId=13"driver = webdriver.Firefox(executable_path=r'C:WebDriversgeckodriver.exe')driver.get(URL)copyright = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.copyrights")))driver.execute_script("return arguments[0].scrollIntoView(true);", copyright)


