【发布时间】:2020-11-26 12:22:01
【问题描述】:
我的代码有问题。
我需要等待 3 秒,然后点击关注按钮。
此代码在网站加载后立即单击“关注”按钮。
for follow in accounts_scrapped:
driver.get(follow)
try:
follow_button = driver.find_element_by_xpath("//span[text() = 'Follow']").click()
print("found follow button")
follow_button.click()
print("followed")
except:
print("already followed this account. Going to next one")
continue
【问题讨论】:
-
使用
time.sleep(3)? -
没有改变任何东西。
-
您点击了两次按钮?
follow_button = driver.find_element_by_xpath("//span[text() = 'Follow']").click()末尾有 .click() -
然后你就完成了
follow_button.click() -
哎呀,我把它弄错了。我想点击一次,但不是立即。
标签: python-3.x selenium webdriver