スクリプトを使用して、非表示のフォーム フィールド変数formContent
の値を値「Hello」に設定しています。Selenium Webdriver は非表示のフォーム フィールドの値を設定しません。
これが私のコードです:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return jQuery('input:hidden[id$=\"formContent\"]').val('Hello');");
スクリプトが応答しません。ここで私が間違っていることを教えてください。私のformContent
xhtmlでは次のように定義されています。
<input type="hidden" id="formContent" name="formContent" value="" />
次のコード行を使用すると、非表示のフォーム フィールド「formContent」の値が設定されません。
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("jQuery('input:hidden[id$=\"formContent\"]').val('Hello');");
ありがとう!