-1

I want to test a website. In this website I will get maximum 10 profiles when I click on search button. For each profile I have to check "Location text" & "Age value between max.age and min.age values". And XPath for all these Locations & Ages are same.

I would like to do this with BEHAT.

Does anybody have an idea about how to write context file and feature file?

Yella
  • 1

1 Answers1

0

you can try something like

  /**
   * Click on element with xpath as parameter 
   *
   * @When /^I click on the element with xpath "([^"]*)"$/
   */
  public function iClickOnTheElementWithXpath($xpath) {
      $session = $this->getSession('selenium2'); // get the mink session
     $element = $session->getPage()->find('xpath', $xpath); // runs the actual query and     returns the element

  // errors must not pass silently
  if (null === $element) 
      throw new InvalidArgumentException(sprintf('Could not evaluate XPath: "%s"', $xpath));

  // ok, let's click on it or any operation you want to do .
  $element->click();

}