我有一个包含超过 50 个列表项的无序列表元素
我尝试滚动到第 10 个
如有任何帮助,我们将不胜感激!
import selenium
from bs4 import BeautifulSoup
from selenium.webdriver.common.keys import Keys
def existOrNot(Xpath):
page =driver.page_source
soup = BeautifulSoup(page, "html.parser")
if soup.find(Xpath):
return(True)
else:
return (False)
Xpath= soup.find("ul", title='test').find("li",title='45')
while not existOrNot(Xpath):
driver.send_keys(Keys.END)
time.sleep(3)