from selenium import webdriver
import time
username = ""
password = ""
getdriver = ("https://www.instagram.com/accounts/login/")
driver = webdriver.Chrome()
driver.get(getdriver)
driver.find_element_by_xpath("//input[@name='username']").send_keys(username)
driver.find_element_by_xpath("//input[@name='password']").send_keys(password)
driver.find_element_by_xpath("//button[contains(.,'Log in')]").click()
time.sleep(5)
driver.get("https://www.instagram.com/python.coders/followers/")
driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/header/section/ul/li[2]/a').click()
while True:
time.sleep(2)
driver.find_element_by_name('Follow').click()
我想单击instagram上的所有“跟随显示按钮”,我不能使用tag_name或name来做到这一点。
答案 0 :(得分:0)