nhsuk / ui-test-core

Python package which helps with writing UI tests by providing a wrapper around Selenium and other useful functions
MIT License
12 stars 6 forks source link

[Feature] Add logging when trying to find elements #16

Closed Phil-87 closed 4 years ago

Phil-87 commented 5 years ago

It would be useful if the auto logging would output info on the element selector when trying to find an element or elements. E.g. you can see something like this in the logging: DEBUG - uitestcore.finder: Entering function elements But there is no info about the PageElement details. Something similar to what is done in the waiter would work well e.g. self.logger.info("Waiting for %s to be visible", page_element) This could be added to the elements() and element() functions in Finder.

gtorchia commented 5 years ago

In the decorator function before return_value = func(*args, **kwargs) it is better to test if the args is a PageElement . This strategy is useful to identify which locators is failing on the current page