使用python中的selenium在instagram上为人们解围
我正在开发一个instagram机器人,其中包括一些不关注的人。 它与selenium一起工作,方法是登录,单击“follow”,然后为每个用户单击unfollow按钮。问题是:当我尝试单击它时,此异常会发生:使用python中的selenium在instagram上为人们解围,python,selenium,instagram,Python,Selenium,Instagram,我正在开发一个instagram机器人,其中包括一些不关注的人。 它与selenium一起工作,方法是登录,单击“follow”,然后为每个用户单击unfollow按钮。问题是:当我尝试单击它时,此异常会发生: selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="sqdOP L3NKy _4pI4F
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="sqdOP L3NKy _4pI4F _8A5w5 " type="button">...</button> is not clickable at point (594, 155). Other element would receive the click: <span class="">...</span>
(Session info: chrome=79.0.3945.130)
我知道另一个项目会收到点击,但我不知道它是什么项目。有人能帮我解决这个问题吗?如果有人看到这个问题,我会这样解决:
unfollow_buttons = driver.find_elements_by_css_selector('.sqdOP.L3NKy._8A5w5')
for button in unfollow_buttons:
if button.text == "Following":
ui.WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.CSS_SELECTOR,
'.sqdOP.L3NKy._8A5w5')))
actions = ActionChains(driver)
actions.move_to_element(button).click().perform()
ui.WebDriverWait(driver, 2).until(
EC.element_to_be_clickable((By.XPATH,'/html/body/div[5]/div/div/div[3]/button[1]')))
driver.find_element_by_xpath('/html/body/div[5]/div/div/div[3]/button[1]').click() # UNFOLLOW CONFIRMATION
time.sleep(1)
如果有人看到这一点,我会这样做:
unfollow_buttons = driver.find_elements_by_css_selector('.sqdOP.L3NKy._8A5w5')
for button in unfollow_buttons:
if button.text == "Following":
ui.WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.CSS_SELECTOR,
'.sqdOP.L3NKy._8A5w5')))
actions = ActionChains(driver)
actions.move_to_element(button).click().perform()
ui.WebDriverWait(driver, 2).until(
EC.element_to_be_clickable((By.XPATH,'/html/body/div[5]/div/div/div[3]/button[1]')))
driver.find_element_by_xpath('/html/body/div[5]/div/div/div[3]/button[1]').click() # UNFOLLOW CONFIRMATION
time.sleep(1)