我正在研究一个自动instagram跟踪机器人。这是关于Udemy的100天代码的练习。
我对这个元素有意见。我找不到跟随者的标签。
我使用以下代码:
def find_follower(self):
time.sleep(2)
self.driver.get(f"https://www.instagram.com/{SIMILAR_ACCOUNT}")
time.sleep(2)
path = self.driver.find_element(by=By.CLASS_NAME, value="_aa_c")
print(path.text)
this_is_what_I_want = self.driver.find_elements(by=By.XPATH, value="//a[@href]")
for item in next2:
element = item.find_element(by=By.TAG_NAME, value="span").get_attribute("_ac2a _ac2b").click()我想按下跟随者的链接。我知道密码是错的。我试了这么多标签,但都没用。
有人知道吗?非常感谢
诚挚的问候
莱文
发布于 2022-10-18 19:33:37
要单击“追随者”按钮,请尝试如下:
self.driver.find_elements(By.CSS_SELECTOR, "a[href*='followers']").click()或者如果你喜欢XPath
self.driver.find_elements(By.XPATH, "//a[contains(@href,'followers')]").click()https://stackoverflow.com/questions/74116270
复制相似问题