Question

I have a symfony 2 project however I have some issue while creating my scenario because tooltip plugin renames title to oldtile, How can I override NamedSelector class from Mink to change some xpath selectors? I need to add "contains(./@oldtitle, %locator%)" to link selector. What would be best approach to override it?

Was it helpful?

Solution

If your FeatureContext extends MinkContext you can try something like this:

/**
 * Override NamedSelector
 */
public function setMinkParameters(array $parameters) {
  parent::setMinkParameters ($parameters);
  $selectors = $this->getSession()->getSelectorsHandler();
  $selectors->getSelector ('named')->registerNamedXpath ('field',  <<<XPATH
.//*...
XPATH
      );
 }

I.e. put your own selector there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top