Reputation: 5
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.
Upvotes: 0
Views: 2527
Reputation: 50809
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.
Upvotes: 2