我尝试使用selenium(使用username和pwd进行身份验证后)使用类似的代码从我的帐户中获取关注者列表:
driver.get("https://www.instagram.com/{0}/".format(account))
# Click the 'Follower(s)' link
r=driver.find_element_by_partial_link_text("follower").click()
print r
# Wait for the followers modal to load
xpath = "//div[@style='position: relative; z-index: 1;']/div/div[2]/div/div[1]"
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, xpath)))
# You'll need to figure out some scrolling magic here. Something that can
# scroll to the bottom of the followers modal, and know when its reached
# the bottom. This is pretty impractical for people with a lot of followers
# Finally, scrape the followers
xpath = "//div[@style='position: relative; z-index: 1;']//ul/li/div/div/div/div/a"
followers_elems = driver.find_elements_by_xpath(xpath)
问题是变量' r'是没有'。访问您自己的粉丝有问题吗?
答案 0 :(得分:1)
Click方法不返回任何内容,因此... r is none