How to use is_method_excluded method in robotframework-pageobjects

Best Python code snippet using robotframework-pageobjects_python

base.py

Source:base.py Github

copy

Full Screen

...34 # it can't be a keyword.35 name = obj.__name__36 except AttributeError:37 return False38 if inspect.isroutine(obj) and not name.startswith("_") and not _Keywords.is_method_excluded(name) and name not in ("get_keyword_names", "run_keyword"):39 return True40 else:41 return False42 @classmethod43 def is_obj_keyword_by_name(cls, name, inst):44 """ Determines whether a given name from the given class instance is a keyword.45 This is used by `get_keyword_names` in `robotpageobjects.page.Page` to decide46 what keyword names to report.47 :param name: The name of the member to check48 :type name: str49 :param inst: The class instance to check (such as a page object)50 :type inst: object51 """52 obj = None53 # If obj is a @property as oppose to a regular method or attribute,54 # its method will be called immediately. This could cause an attempt55 # to retrieve an element via webdriver, but when this method is called56 # no browser is open, so that will cause Selenium2Library's decorator57 # to attempt a screenshot - which will fail, because no browser is open.58 # To prevent this, we temporarily set inst._has_run_on_failure to True.59 # (_has_run_on_failure is used by Selenium2Library's decorator to prevent60 # redundant screenshot attempts.)61 inst._has_run_on_failure = True62 try:63 obj = getattr(inst, name)64 except Exception:65 inst._has_run_on_failure = False66 return False67 inst._has_run_on_failure = False68 return cls.is_obj_keyword(obj)69 @classmethod70 def is_method_excluded(cls, name):71 """72 Checks whether a method is to be excluded from keyword names.73 :param name: The name of the method to check74 :type name: str75 :returns: boolean76 """77 return cls._exclusions.get(name, False)78 @classmethod79 def get_robot_aliases(cls, name, pageobject_name):80 """81 Gets an aliased name (with page object class substitued in either at the end82 or in place of the delimiter given the real method name.83 :param name: The name of the method84 :type name: str...

Full Screen

Full Screen

page.py

Source:page.py Github

copy

Full Screen

...189 in_s2l_base = True190 # Don't add methods belonging to S2L to the exposed keywords.191 if in_s2l_base and (in_ld or _Keywords.has_registered_s2l_keywords):192 continue193 elif inspect.ismethod(obj) and not name.startswith("_") and not _Keywords.is_method_excluded(name):194 # Add all methods that don't start with an underscore and were not marked with the195 # @not_keyword decorator.196 if not in_ld:197 keywords += _Keywords.get_robot_aliases(name, self._underscore(self.name))198 else:199 keywords.append(name)200 _Keywords.has_registered_s2l_keywords = True201 return keywords202 def _attempt_screenshot(self):203 try:204 self.capture_page_screenshot()205 except Exception, e:206 if e.message.find("No browser is open") != -1:207 pass...

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 robotframework-pageobjects 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