How to use set_implicitly_wait method in toolium

Best Python code snippet using toolium_python

basepage.py

Source:basepage.py Github

copy

Full Screen

...21 # 收集删除联系人前后的名单列表的长度,分别放入列表中22 _contactor_num = []23 def __init__(self, driver: WebDriver = None):24 self.driver = driver25 def set_implicitly_wait(self, timeout):26 self.driver.implicitly_wait(timeout)27 def find(self, by, locator=None):28 logger.info(f"find: by = {by},locator = {locator}")29 try:30 element = self.driver.find_element(by, locator)31 self._error_num = 032 self.set_implicitly_wait(10)33 return element34 except Exception as e:35 logger.info("进入黑名单处理")36 self.driver.get_screenshot_as_file('../report/error.png')37 self.set_implicitly_wait(3)38 if self._error_num > self._error_max:39 self._error_num = 040 self.set_implicitly_wait(10)41 raise e42 self._error_num += 143 for black in self._black_list:44 eles = self.finds(*black)45 if len(eles) > 0:46 eles[0].click()47 return self.find(by, locator)48 raise e49 def finds(self, by, locator=None):50 return self.driver.find_elements(by, locator)51 def find_click(self, by, locator):52 return self.find(by, locator).click()53 def send(self, by, locator, value):54 return self.find(by, locator).send_keys(value)...

Full Screen

Full Screen

classtimetable.py

Source:classtimetable.py Github

copy

Full Screen

...15 # memu_ele = (By.XPATH, f'//div[@class="we-sider-menu app-sider-menu"]//span[contains(text(),"{memu}")]')16 # self.wait_for_display(memu_ele)17 # self.find_click(*memu_ele)18 self._params["memu"] = memu19 self.set_implicitly_wait(3)20 self.step(classtimetable_dir,"goto_undergradute_record")21 return UnderGraduteRecord(self._driver)22 def goto_teacher_management_degree(self,memu):23 '''24 打開教師課表(管理端-本科生)25 '''26 self._params["memu"] = memu27 self.set_implicitly_wait(5)28 self.step(classtimetable_dir, "goto_teacher_management_degree")29 return Teacher_Management_Degree(self._driver)30 def goto_teacher_management_master(self,memu):31 '''32 打開教師課表(管理端-研究生)33 '''34 self._params["memu"] = memu35 self.set_implicitly_wait(3)36 self.step(classtimetable_dir, "goto_teacher_management_master")37 return Teacher_Management_Master(self._driver)38 def goto_room_management_degree(self,memu):39 '''40 打開課室課表(管理端-本科生)41 '''42 self._params["memu"] = memu43 self.set_implicitly_wait(3)44 self.step(classtimetable_dir, "goto_room_management_degree")45 return Room_Management_Degree(self._driver)46 def goto_room_management_master(self,memu):47 '''48 打開課室課表(管理端-研究生)49 '''50 self._params["memu"] = memu51 self.set_implicitly_wait(3)52 self.step(classtimetable_dir, "goto_room_management_master")53 return Room_Management_Master(self._driver)54 def goto_student_management_degree(self,memu):55 '''56 打開學生課表(管理端-本科生)57 '''58 self._params["memu"] = memu59 self.set_implicitly_wait(3)60 self.step(classtimetable_dir, "goto_student_management_degree")61 return Student_Management_Degree(self._driver)62 def goto_student_management_master(self,memu):63 '''64 打開學生課表(管理端-研究生)65 '''66 self._params["memu"] = memu67 self.set_implicitly_wait(3)68 self.step(classtimetable_dir, "goto_student_management_master")69 return Student_Management_Master(self._driver)70 def goto_postgraduate_sign_in_record(self,memu):71 '''72 測試入口,打開研究生簽到記錄73 '''74 self._params["memu"] = memu75 self.set_implicitly_wait(3)76 self.step(classtimetable_dir, "goto_postgraduate_sign_in_record")...

Full Screen

Full Screen

page_read.py

Source:page_read.py Github

copy

Full Screen

...21 article.click()22 return ArticlePage()23 @classmethod24 def get_video_time(cls, article: WebElement):25 cls.set_implicitly_wait(1)26 _list = article.find_elements_by_xpath('//*[contains(@text, ":")]')27 cls.set_implicitly_wait(6)28 if _list:29 return _list[0].get_attribute('text')30 else:31 return None32 @classmethod33 def simulate_page_turning(cls):34 _num = random.randint(5, 7)35 for _ in range(_num):36 cls.swipe_up()37 @classmethod38 def switch_channel(cls, channel: str):39 _channel = (cls.MB.XPATH, f'//*[@text="{channel}"]/..')40 try:41 cls.find(_channel).click()42 except NoSuchElementException:43 logger.critical(f'该频道不存在,请检查:{channel}')44class RDPage(StudyPage):45 def __init__(self):46 super(RDPage, self).__init__()47 self.sign = 'read'48 self._channel_recommend = (self.MB.XPATH, '//*[@text="推荐"]')49 self._channel_button = (self.MB.XPATH, '//*[@text="推荐"]/../../following-sibling::android.widget.FrameLayout')50 def verify_page_visible(self):51 return self.find(self._channel_recommend).is_displayed()52 def open_channel_group(self):53 self.find(self._channel_button).click()54 return ChannelPage()55 @classmethod56 def is_article(cls, article: WebElement):57 cls.set_implicitly_wait(0.2)58 # 文章需要有日期59 _date = article.find_elements_by_xpath('//*[starts-with(@text,"2019-")]')60 if len(_date) == 0:61 cls.set_implicitly_wait(6)62 return False63 # 文章不应该有播放时间64 _time = article.find_elements_by_xpath('//*[contains(@text, ":")]')65 if len(_time) != 0:66 cls.set_implicitly_wait(6)67 return False68 # # 文章不应该有播放进度条69 # _seek = article.find_elements_by_class_name('android.widget.SeekBar')70 # if len(_seek) != 0: return False71 # 文章不包含专题两个字72 _special = article.find_elements_by_xpath('//*[contains(@text, "专题")]')73 if len(_special) != 0:74 cls.set_implicitly_wait(6)75 return False76 # TODO: 需要更优雅地实现设置隐式等待时间77 cls.set_implicitly_wait(6)78 return True79'''80new UiScrollable(new UiSelector().resourceId("cn.xuexi.android:id/view_pager")).setAsHorizontalList().scrollIntoView(new UiSelector().text("订阅"))81new UiScrollable(new UiSelector().className("android.widget.ListView")).setAsHorizontalList().scrollIntoView(new UiSelector().text("订阅"))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run toolium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful