使用水豚,我正在尝试填写日期。表单上有一个javascript日期选择器。我尝试了以下方法来选择它:
find('input[type=date]').focus()
find(:xpath, ".//*[@id='Sdate']")
fill_in('Sdate', :with => '25/07/2555')
但是对于所有这些尝试,我收到了完全相同的错误消息:
Selenium::WebDriver::Error::UnknownError: '[JavaScript Error: "a is null" {file: "file:///var/folders/ky/r1ft86wd5x9cjq0f3f6tq0600000gn/T/webdriver-profile20120725-41019-m72bh5/extensions/fxdriver@googlecode.com/components/command_processor.js" line: 5813}]' when calling method: [nsICommandProcessor::execute]
我想填写的HTML:
<input id="Sdate" type="text" readonly="" value="" size="10" name="Sdate">
<img align="absmiddle" onclick="return showCalendar('Sdate', 'dd/mm/yy');" style="cursor:pointer" src="../images/calendar_s.gif">
我在Rails 3.2.6任务中使用带有Capybara 1.1.2的Firefox上的Selenium webdriver。
我错过了什么?
答案 0 :(得分:1)
我有相同的设置,我可以用这一行选择框:
select 'May', from: 'date_select_1'
其中'May'是您要从列表中选择的值,而* data_select_1 *是您要从中选择值的HTML标记的ID。