購入ボタンを表示できるチェックボックスをクリックしようとしています。使用しようとすると、「NoMethodError: undefined method 'eula' for Cart:0x101f54810」というエラーが表示されます。同一のチェックボックスが 2 つあるためと思われますが、確かではありません。
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
更新: オブジェクト タイプを変更して動作させようとしていました。要素は、私が試した最後のタイプでした。例をチェックボックスに戻しました(最初の試み)。ご指摘ありがとうございます。