def build(self, image): self.go_to_tab() if self.IMAGES.index(image) > 3: helpers.scroll_to_bottom() else: helpers.scroll_to_top() self.add_or_remove_clones([image], click_image=self.PLUS)
def equip_crystals(self): """ Uses the auto equip feature """ coordinates = Planet.COORDINATES pg.click(coordinates.tab) helpers.click_image_on_screen(Planet.CRYSTAL, coordinates) helpers.scroll_to_bottom(coordinates) pg.scroll(500) helpers.click_image_on_screen(Planet.EQUIP_ALL, coordinates)
def upgrade_crystals(self): """ Uses the auto upgrade feature """ coordinates = Planet.COORDINATES pg.click(coordinates.tab) helpers.click_image_on_screen(Planet.CRYSTAL, coordinates) helpers.scroll_to_bottom(coordinates) pg.scroll(500) print("sleeping") time.sleep(5) helpers.click_image_on_screen(Planet.MAX_ALL, coordinates)
def create(self, image): """ Will start creating given element, regardless of next at setting """ self.go_to_tab() coordinates = self.COORDINATES helpers.scroll_to_top() if self.IMAGES.index(image) >= self.IMAGES.index(self.NATION): pg.moveTo(coordinates.center_of_screen) pg.scroll(-2300) # magic number for weather scroll positions elif self.IMAGES.index(image) > self.IMAGES.index(self.WEATHER): helpers.scroll_to_bottom() zone = helpers.get_active_zone(image, 500, 60, coordinates) helpers.click_image_in_zone(self.CREATE, zone=zone)
def upgrade(self, image): self.go_to_tab() if self.IMAGES.index(image) > 3: helpers.scroll_to_bottom() else: helpers.scroll_to_top() time.sleep(0.1) zone = self.check_if_cached(image) if zone == -1: zone = helpers.get_active_zone(image, 500, 60, self.COORDINATES) if zone == -1: return y_value = zone[1] + 40 y_2_value = zone[3] + 40 upgrade_zone = (zone[0], y_value, zone[2], y_2_value) helpers.click_image_in_zone(self.PLUS, zone=upgrade_zone)
def see_more(driver): print("seeing more...") helpers.navigation_panel(driver) # search for Activity log selection in logout panel try: e_activity_log = driver.find_element_by_partial_link_text( 'Activity log') e_activity_log.click() # go_to_activity_log(driver) except NoSuchElementException: print("Cannot find Activity log selection") print("Going to Activity log page via profile page instead") go_to_activity_log(driver) time.sleep(SHORT_PAUSE_TIME) # search for Posts selection in sidebar try: e_posts = driver.find_element_by_xpath('//*[@title="Posts"]') e_posts.click() except NoSuchElementException: print("Cannot find Posts button") exit() time.sleep(LONG_PAUSE_TIME) helpers.scroll_to_bottom(driver, LONG_PAUSE_TIME) time.sleep(SHORT_PAUSE_TIME) # search for all 'See more's in the page try: e_see_more = driver.find_elements_by_xpath( ".//span[@class='see_more_link_inner']") e_see_more.reverse() print("Total see mores: ", len(e_see_more)) for element in e_see_more: driver.execute_script("arguments[0].click();", element) time.sleep(SHORT_PAUSE_TIME) except NoSuchElementException: print("Cannot find See more button") exit()