Published on September 24, 2012
In the latest Codeception 1.1.4 new
Locator class was introduced. Basically it should simplify your life in writing complex XPath or CSS locators. Right now it has minimal, yet useful functionality.
Locator can combine two locators using
This will search for
Title text in either
h3 tag. You can also combine CSS selector with XPath locator:
As a result the Locator will produce a mixed XPath value that will be used in fillField action.
Do you often use the
TAB key to navigate through the web page? How do your site respond to this navigation?
You could try to match elements by their tab position using
tabIndex method of
Does the page contain link wo specified URL? Check that easily with
href method of
And that’s all folks for today. We are sure the locator class will evolve to simplify writing complex locators. If you have ideas what methods should be added, post them here. Or, which is better, patch this class and send Pull Request to Github.
Write and execute a test for an existing app
in less then 5 minutes!