Skip to content

Instantly share code, notes, and snippets.

@thepycoach
Last active April 22, 2021 23:23
Show Gist options
  • Select an option

  • Save thepycoach/dce27bb60b85c81daa96d7b3d288d99b to your computer and use it in GitHub Desktop.

Select an option

Save thepycoach/dce27bb60b85c81daa96d7b3d288d99b to your computer and use it in GitHub Desktop.
# update 3 (commented code not necesssary anymore)
# for sport in sport_title:
# selecting only football
# if sport.text == 'Football':
parent = sport_title.find_element_by_xpath('./..') #immediate parent node
# update 4 (+3 times .find_element_by_xpath('./..'))
grandparent = parent.find_element_by_xpath('./..').find_element_by_xpath('./..').find_element_by_xpath('./..').find_element_by_xpath('./..')
#3. empty groups
try:
empty_groups = grandparent.find_elements_by_class_name('EventOddGroup-styles-empty-group')
empty_events = [empty_group.find_element_by_xpath('./..') for empty_group in empty_groups[:]]
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment