ruankie / gurushots-auto-fill

Automate the tedious exposure filling process on GuruShots
5 stars 8 forks source link

'WebElement' object is not subscriptable #2

Open thiva7 opened 2 years ago

thiva7 commented 2 years ago

Hey , i just try it and give me this error *** ERROR: 'WebElement' object is not subscriptable

its come from this line

''' vote_buttons = driver.find_element(By.XPATH , "//div[@ng-click='$ctrl.vote()']")

try:
    # click on challenge vote button
    vote_button = vote_buttons[challenge_nb] # this is the error
    driver.implicitly_wait(IMPLICIT_WAIT)

'''

ruankie commented 2 years ago

Hi @thiva7 Thanks for checking out this repo and pointing this out!

It looks like driver.find_element returns a single object of instance WebElement. To be able to index it, it needs to return a list of these objects. This is achieved by calling driver.find_elements instead (quite a subtle difference - just adding an extra "s").

I have made some updates just now and it worked for me. Please pull from main again and let me know it works on your side 😀

thiva7 commented 2 years ago

Lol I found out after I open the ticket. I have made some changes, can I make pull requests?

ruankie commented 2 years ago

@thiva7 yes please make the PR and I'll review it when I get a chance. Thanks for contributing 💃