私は selenium-standalon-2.25.0 を使用しており、chrome はバージョン 13 です。
html は次のとおりです。
<select name="suffix" class="select">
<option value="" selected>Please select...</option>
<option value="Ms.">Ms.</option>
<option value="Mrs.">Mrs.</option>
<option value="Mr.">Mr.</option>
</select>
オプションの 1 つを選択するために呼び出すコマンドを次に示します。もう 1 つは、db から取得した変数であり、問題は、db から取得した接尾辞です。これは、Firefox と IE では機能しますが、Chrome では機能しません。
driver.findElement(By.xpath("//option[@value='" + other + "' and ..[@name='" + question + "']]")).click();
これは私が得ている例外です:
org.openqa.selenium.InvalidSelectorException: findElement execution failed;
Unable to locate an element with the xpath expression //option[@value='Ms.' and ..[@name='suffix']] because of the following error:
Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 52 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_25'
Driver info: driver.version: EventFiringWebDriver
Session ID: bf6368f23db4a2fe27d9b96849af1b1d
Command duration or timeout: 646 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-31-generic', java.version: '1.6.0_31'
Driver info: driver.version: RemoteWebDriver
Session ID: 134947044387
私はしばらくこれに取り組んできましたが、私の推測では、私の findElement ステートメントに関係しています。奇妙な部分は、FF と IE で正常に動作することです。どんな助けでも大歓迎です。再度、感謝します。
ブライアン