購入ボタンを表示するためのチェックボックスをクリックしようとしています。私はそれを使用しようとすると、 "NoMethodError:未定義のメソッド 'eula' for Cart:0x101f54810というエラーが発生します。私は2つの同一のチェックボックスがあるためかもしれないと思うが、私は確信していない。Page-Objectの重複チェックボックスが定義されていませんか?
HTML:
<p id="eula-box" class="annoy cc"><input type="checkbox" name="terms_of_service" value="terms_of_service" tabindex=20 />I have read & agree to the End-User License Agreement.</p>
<p id="eula-box" class="annoy pp"><input type="checkbox" name="terms_of_service" value="terms_of_service" tabindex=20 />I have read & agree to the End-User License Agreement.</p>
私のクラス:
require 'rubygems'
require 'page-object'
require 'page-object/page_factory'
require 'watir-webdriver'
CART_URL = 'http://www.anonymizer.com/cart/checkout.html?SKU=ANONUNV12'
class Cart
include PageObject
page_url CART_URL
checkbox(:eula, :class=>"annoy_cc")
button(:purchase, :value=>'purchase')
def complete_order(data = {})
self.eula.click
end
end
Udpated:私はそれが動作するように取得しようと周りのオブジェクト・タイプを変更されました。要素が私が試した最後のタイプでした。私は私の例をチェックボックスに戻しました(私の元の試み)。それを指摘してくれてありがとう。
本当に同じIDを持っていますか?それは無効なHTMLです。 –