私はHTMLでこのコードを持っている:ウェブドライバC#のxpth CSSの要素の識別
<br>
input name="commit" value="Apply" style="" type="submit"
<br>
をそして、それは私が次のエラーメッセージが表示されます、私は
heredriver.FindElement(By.XPath("//input[@name='commit'][4]")).Click();
or
driver.FindElement(By.CssSelector("#new_reduction > input[name="commit"]")).Click();
にウェブ・ドライバ・コードで書いたものです:
そのような要素:要素が見つかりません:{ "方法": "のXPath"、 "セレクタ": "//入力【名@ = 'コミット'] [4]"}
コメントから
追加html
:
<form class="new_reduction" id="new_reduction" action="/admin/reductions" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="authenticity_token" value="mZHoKI82s1fk7w2FCsqbNiGM9kJyE45dzwV3w2cuFzniZe6lDDum9LDNxAsIokpxH90b/cFxqCil5EMvuvBwA==">
Coupon Code:
<input value="3167050" type="hidden" name="reduction[order_id]" id="reduction_order_id">
<input value="81069" type="hidden" name="reduction[web_user_id]" id="reduction_web_user_id">
<input type="text" name="code" id="code">
<input type="submit" name="commit" value="Apply">
</form>
のないエラーとは何ですか? – Guy
追加情報:該当しない要素:{"method": "xpath"、 "selector": "// input [@ name = 'commit'] [4]」 –
あなたの要素は' iframe '? – NarendraR