작은 스크립트를 작성하고 문제가 발생했습니다. 목록을 아래로 스크롤하려고하지만 제대로 작동하지 않습니다. 스크롤 목록 셀레늄 (Python)
Screen of the list Screen of the html code
WebDriverWait(driver, 20).until(lambda x: x.find_element_by_xpath("//li[@class = '_6e4x5']"))
난 정말 당신의 도움이 필요합니다 : 여기에 내 코드
def get_followers(self):
try:
self.driver.find_elements_by_css_selector('a._t98z6')[0].click()
except Exception as e:
print("Sorry, i don't have access to your followers: {0}".format(e))
else:
followers = []
while True:
self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
try:
WebDriverWait(driver, 20).until(lambda x: x.find_element_by_css_selector('li._6e4x5')) #It doesn't find element.
except:
break
followers = self.driver.find_elements_by_css_selector("a._2g7d5.notranslate._o5iw8")
return followers
나는 또한이 같은 XPath를 사용하려고합니다. 고마워요
목록의 모양을 알 수있는 스크린 샷과 a._t98z6 및 li._6e4x5 요소의 html 코드를 제공하십시오. 클래스 (_t98z6 및 _6e4x5)는 동적 인 값처럼 보이며 매번 페이지에 들어갈 때 변경되지 않는다고 확신합니까? – yong
클래스 _t98z6은 동적 값이 아닙니다. – Kolya
스크린 샷을 업로드하는 것을 잊었습니까? – yong