我在这里使用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());