def get_team(self, player): team = [] xpath = "//div[@class='{}']/div[@class='trainer']/div[@class='teamicons']//span" poke_elems = self.root.find_elements_by_xpath(xpath.format(PLAYER_ELEMS[player.value])) for poke_elem in poke_elems: team.append(ShowdownPokemon.from_team_icon(poke_elem)) return team
def get_my_full_team(self): xpath = "//div[@class='switchmenu']/button" poke_buttons = self.root.find_elements_by_xpath(xpath) pokemon = [] for poke_button in poke_buttons: ActionChains(self.driver).move_to_element(poke_button).perform() tooltip = self.driver.find_element_by_xpath(self.TOOLTIP_PATH) pokemon.append(ShowdownPokemon.from_pop_up(poke_button, tooltip)) return pokemon
def get_active_pokemon(self, player): xpath = "//div[@class='statbar {}']/strong".format(ACTIVE_POKE_ELEMS[player.value]) poke_elem = self.root.find_element_by_xpath(xpath) return ShowdownPokemon.from_team_icon(poke_elem)