Best Python code snippet using robotframework-appiumlibrary_python
MyLibrary.py
Source:MyLibrary.py  
...61    my_month = get_new_month_name(mydate)62    my_day = str(Odate.day)63    my_year = str(Odate.year)64    logger.console(my_month)65    wheel = newlib._find_elements_by_class_name("XCUIElementTypePickerWheel")66    #Set Month67    wheel[0].set_value(my_month)68    #Set Day69    wheel[1].set_value(my_day)70    #set Year71    wheel[2].set_value(my_year)72def set_android_calendar_date(date):73    newlib = BuiltIn().get_library_instance("AppiumLibrary")74    # day = datetime.date(date)75    # logger.console(day)76    newlib.click_element('date_picker_header_year')77    wheel = newlib._find_elements_by_class_name("android.widget.DatePicker")78    wheel[1].input_value("13")79    wheel[2].set_value("2016")80def scroll_try(locator):81    # newlib = BuiltIn().get_library_instance("AppiumLibrary")82    # element = newlib._element_find(locator, True, True)83    # element.set_value("6/2/2017")84 def _get_screenshot_paths(self, filename):85        if not filename:86            self._screenshot_index += 187            filename = 'appium-screenshot-%d.png' % self._screenshot_index88        else:89            self._screenshot_index += 190            filename = filename + '-%d.png' % self._screenshot_index91            #filename = filename.replace('/', os.sep)...feed.py
Source:feed.py  
...9        BasePage.__init__(self, driver)10        self._path = "/"1112    def _get_clickable_topic_by_id(topic_id):13        clickable_topics = self._find_elements_by_class_name("topic-clickable")14        matches = filter(lambda x: x.get_attribute('id') == topic_id, clickable_topics) 15        return matches[0]1617    # def get_unsubscribed_topics(self):1819       20    def get_subscribed_topics(self):21        user_topics = self._find_elements_by_class_name("subscribed")22        return utils.filter_hidden(user_topics)2324    def edit_topics(self):25        edit_btn = WebDriverWait(self.driver, 6).until(EC.presence_of_element_located((By.ID, "edit")))26        # self._find_element_by_id("edit")27        edit_btn.click()2829    def unsubscribe_from_a_topic(self):30        topics = self.get_subscribed_topics()31        # print len(topics)32        rand_index = utils.random_number(len(topics) - 1)33        # print rand_index34        unsub_topic_id = topics[rand_index].get_attribute('data-topicid')35        self.edit_topics()
...splash_page.py
Source:splash_page.py  
...6        BasePage.__init__(self, driver)7        self._path = "/"89    def select_topic_at_random(self):10        topics = self._find_elements_by_class_name('tpk')11        rand_index = utils.random_number(len(topics))12        topic = topics[rand_index]13        topic.click()1415    def select_topic(self, topic_id):16        topic_link = self._find_element_by_id(str(topic_id))17        topic_link.click()1819
...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
