selenium驱动程序,optgroup内的选项无法执行

时间:2012-03-12 16:20:39

标签: php selenium phpunit selenium-chromedriver

我在这里使用PHP webdriver绑定: http://code.google.com/p/php-webdriver-bindings/

我可以选择option中的标准<select>元素没有问题,但当它们是<optgroup>的孩子时,click()方法不会更改所选项目。< / p>

找到元素(我可以var_dump元素的细节)。我正在使用的代码是:

$xpath = "//select[@name='{$element}']/optgroup[@label='{$optgrp}']/option[@value='{$value}']";
$element = $this->_webdriver->findElementBy(LocatorStrategy::xpath, $xpath);
$element->click();

如果我接下来这样做,它就会失败。

$this->assertTrue($element->isSelected());

0 个答案:

没有答案