小编Gin*_*Its的帖子

无法评估XPath(Behat/Mink)

我正在使用以下功能:

    /**
    * Click on the element with the provided xpath query
    *
    * @When /^I click on the element with xpath "([^"]*)"$/
    */
   public function iClickOnTheElementWithXPath($xpath)
   {
       $session = $this->getSession(); // get the mink session
       $element = $session->getPage()->find('xpath',$session->getSelectorsHandler()->selectorToXpath('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
       $element->click();

   }
Run Code Online (Sandbox Code Playgroud)

在我的FeatureContext.php中试图点击一个带有以下XPath的按钮(Behat Step is):当我点击带有XPath的元素时 …

xpath behat mink

5
推荐指数
1
解决办法
3277
查看次数

标签 统计

behat ×1

mink ×1

xpath ×1