简体   繁体   中英

How to check if a button has been clicked using selenium on python

def LikePhotos(self, amount):
        bot = self.bot
        #if button is being clicked then move to next pic else click then move to next pic
        if():
            print("Button has already been clicked")
        else:
            print("Button hasn't been clicked!")    
        bot.find_element_by_class_name("_9AhH0").click()

This is not how Selenium works. Selenium can send a command to the browser to click a button, but cannot check if a button was clicked by some other means.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM