问题
I am using the PHP webdriver bindings here: http://code.google.com/p/php-webdriver-bindings/
I can select standard option
elements in a <select>
no problem, but when they are a child of an <optgroup>
the click() method doesn't change the selected item.
The element is found (i can var_dump
the details of the element). The code I am using is:
$xpath = "//select[@name='{$element}']/optgroup[@label='{$optgrp}']/option[@value='{$value}']";
$element = $this->_webdriver->findElementBy(LocatorStrategy::xpath, $xpath);
$element->click();
If I then do the below, it will fail.
$this->assertTrue($element->isSelected());
来源:https://stackoverflow.com/questions/9670804/selenium-driver-option-inside-optgroup-fails-to-execute