0
if href.startswith("https://store.steampowered"):
    browser.get(href)

    if browser.current_url.startswith("https://store.steampowered.com/agecheck"):
        area = browser.find_element_by_id("agecheck_form")
        location_field = area.find_element_by_id("ageYear")

        for option in location_field.find_elements_by_tag_name("option"):
            if int(option.text) == 1999:
                option.click()
                break

            enter = browser.find_element_by_xpath('//*[@id="agecheck_form"]/a')
            enter.location_once_scrolled_into_view.click()

My intention for this bit of code is to go to a steam game page to grab the price of the game. If it encounters the age check wall it runs my above code.

https://store.steampowered.com/agecheck/app/489830/

My problem is no matter what way I format the click event on the enter button, it gives me the error: 'dict' object has no attribute 'click'

I have searched into what dictionaries are and still am stumped. I have my suspicions that this problem could be related to my option loop.

1 Answer 1

2

location_once_scrolled_into_view returns dictionary, the x and y coordinates of the webelement. Just remove it, selenium will scroll automatically to the webelement before the click.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks a lot! I knew it would've been something simple/stupid
I have the same problem, I had to downgrade selenium to make it work. Can you please elaborate on your solution, I dont understand it fully
@Ash the solution was to remove location_once_scrolled_into_view and just click on the element, I'm not really sure what I can add to that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.