Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'WebElement' object is not subscriptable #2

Open
thiva7 opened this issue Sep 2, 2022 · 3 comments
Open

'WebElement' object is not subscriptable #2

thiva7 opened this issue Sep 2, 2022 · 3 comments

Comments

@thiva7
Copy link

thiva7 commented Sep 2, 2022

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
Copy link
Owner

ruankie commented Sep 3, 2022

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
Copy link
Author

thiva7 commented Sep 5, 2022

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

@ruankie
Copy link
Owner

ruankie commented Sep 5, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants