【发布时间】:2016-07-20 11:41:13
【问题描述】:
试图在页面中查找 Xpath。 这是我的代码。
$session = $this->getSession();
$found = $session->getPage()->findAll('xpath', '//meta[@name ="description"]/@content');
if (is_null($found)) {
throw new \Exception(sprintf("Could not find meta %s='%s' with '%s'",));
}
给出错误
无效的选择器:xpath 表达式的结果 "//html//meta[@name ="description"]/@content" 是:[object Attr]。它 应该是一个元素。 (会话信息:chrome=51.0.2704.103) (驱动程序信息:chromedriver=2.21.371459(36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),平台=Mac OS X 10.10.5 x86_64) (警告:服务器未提供任何堆栈跟踪 信息)
【问题讨论】: