def click_on_tab(self, name): css_sel = 'nav.primary-sidebar li a' err_msg = '{} btn in {} not found'.format(name, self) btn = find_web_elem_with_text(self.web_elem, css_sel, name.lower(), err_msg) err_msg = 'cannot click on {} in {}'.format(name, self) click_on_web_elem(self.web_elem, btn, err_msg)
def _click_on_dropdown_item(self, name): if self.is_expanded(): btn = getattr(self, '_{}_btn'.format(name.replace(' ', '_'))) click_on_web_elem(self.driver, btn, lambda: 'cannot click on {} in ' '{}'.format(name, self)) else: raise RuntimeError('unexpanded user profile dropdown in op')
def click_on_tab(self, name): css_sel = 'nav.primary-sidebar li a' err_msg = '{} btn in {} not found'.format(name, self) btn = find_web_elem_with_text(self.web_elem, css_sel, name.lower(), err_msg) err_msg = 'cannot click on {} in {}'.format(name, self) click_on_web_elem(self.web_elem, btn, err_msg)
def _click_on_dropdown_item(self, name): if self.is_expanded(): btn = getattr(self, '_{}_btn'.format(name.replace(' ', '_'))) click_on_web_elem( self.driver, btn, lambda: 'cannot click on {} in ' '{}'.format(name, self)) else: raise RuntimeError('unexpanded user profile dropdown in op')
def chdir(self, path): breadcrumbs = self._breadcrumbs i, dir1, dir2 = None, None, None err_msg = '{dir} not found on {idx}th position in {item}' for i, (dir1, dir2) in enumerate(izip(path.split('/'), breadcrumbs)): assert dir1 == dir2.text, err_msg.format(dir=dir1, idx=i, item=self) click_on_web_elem(self.driver, dir2, lambda: 'cannot click on {idx}th element in ' '{item}'.format(idx=i, item=self))
def _click_on_toggle(self): click_on_web_elem( self.driver, self._toggle, lambda: 'cannot click on toggle for ' '{}'.format(str(self)))
def click(self): click_on_web_elem(self.driver, self._click_area, lambda: 'cannot click on {}'.format(str(self)))
def _click_on_btn(self, btn_type): btn = getattr(self, '_{}_btn'.format(btn_type)) click_on_web_elem( self.driver, btn, lambda: 'cannot click on {} btn in ' '{}'.format(btn_type, str(self)))
def click_on_cp_btn(d, btn, err_msg): click_on_web_elem(d, btn, err_msg)
def click(self): click_on_web_elem(self.driver, self._click_area, lambda: 'cannot click on {}'.format(str(self)))
def click_on_tool(self, name): tool = getattr(self, '_{tool}_tool'.format(tool=name)) tool_icon = tool.find_element_by_css_selector('.oneicon') click_on_web_elem(self.driver, tool_icon, lambda: 'cannot click on "{}" in ' '{}'.format(name, self))
def __call__(self, *args, **kwargs): click_on_web_elem(self.driver, self.web_elem, lambda: 'cannot click on {btn}'.format(btn=self))
def _click_on_btn(self, btn_name): btn = self._get_btn(btn_name) click_on_web_elem( self.driver, btn, lambda: 'cannot click on {btn} in ' '{item}'.format(btn=btn_name, item=self))
def __call__(self, *args, **kwargs): click_on_web_elem(self.driver, self.web_elem, lambda: 'cannot click on {btn}'.format(btn=self))
def unset_from_home(self): if self.is_home(): click_on_web_elem(self.driver, self._home_icon, 'cannot click on home icon for {item} in ' '{parent}'.format(item=self, parent=self.parent))
def unset_from_home(self): if self.is_home(): click_on_web_elem( self.driver, self._home_icon, 'cannot click on home icon for {item} in ' '{parent}'.format(item=self, parent=self.parent))
def click_on_btn(d, elem, msg): click_on_web_elem(d, elem, msg)
def _click_on_btn(self, btn_type): btn = getattr(self, '_{}_btn'.format(btn_type)) click_on_web_elem(self.driver, btn, lambda: 'cannot click on {} btn in ' '{}'.format(btn_type, str(self)))
def click_on_cp_btn(d, btn, err_msg): click_on_web_elem(d, btn, err_msg)
def _click_on_toggle(self): click_on_web_elem(self.driver, self._toggle, lambda: 'cannot click on toggle for ' '{}'.format(str(self)))
def click_on_btn(d, elem, msg): click_on_web_elem(d, elem, msg)