我正在尝试在此处的Value参数中写入“,10”:
<input id="import_product_categories" type="hidden" value="" name="import_params[category_ids]"></input>
使用硒我知道它需要用Javascript完成,由于某种原因,下面的代码在stackoverflow中的另一个答案中不起作用
browser.execute_script("document.getElementById('import_product_categories').value+=',10'")
java scipt代码中有一个小错误。js中的所有行也以;结尾 您错过了。另外,如果要将文本添加到文本框中的现有值,请执行以下js代码
String setText = "document.getElementById('import_product_categories').value += 'hello';";
如果您不想附加文本,请执行此文本。
String setText = "document.getElementById('import_product_categories').value += 'hello';";
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句