我是水豚和 jruby 的新手。作为我的实践之一,我使用了way2sms 网站。单击发送短信后,控件无法找到输入电话号码的元素。
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'selenium-webdriver'
include Capybara::DSL
Capybara.run_server = false
Selenium::WebDriver::Firefox.path = "C:/Program Files/Mozilla Firefox/firefox.exe"
Capybara.default_driver = :selenium
visit "http://www.way2sms.com"
page.find(:xpath, '/html/body/form/div/div/div[2]/div/div/div[2]/a').click
fill_in('username',:with=>"username")
fill_in('password',:with=>"password")
click_button('button')
page.find(:xpath, '//*[@id="quickclose1"]').click
page.find(:xpath, '//*[@id="quicksms"]').click
page.fill_in('MobNo',:with=>"mobile number")
page.fill_in('textArea',:with=>"Some message5")
page.find(:xpath, '//*[@id="Send"]').click
click_button('Send SMS')
当我运行它时,它显示以下错误,
Capybara::ElementNotFound: cannot fill in, no text field, text area or password
field with id, name, or label 'MobNo' found.
任何人都可以帮助我解决这个问题...