selenium driver, option inside optgroup fails to execute

北战南征 提交于 2019-12-12 15:24:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!