@integration @no-database-cleaner @javascript
Scenario: Create New Mortality Table for ShipCase 2.2.2.5
Given shipcase user logs into test environment with password: "*******"
Given the user chooses to add a new mortality base table
And the user specifies "TestScriptMortalityTable" as name for base mortality table
And the user chooses "Male" as Gender , "qx" as type, "United States" as region and "2011" as base year for the mortality table
And I specify the following mortality rates:
| age | mortality_risk |
| 0 | 0.1 |
| 1 | 0.2 |
| 2 | 0.000200332 |
| 3 | 0.000200332 |
| 4 | 0.000200332 |
| 5 | 0.000200332 |
| 6 | 0.000200332 |
| 7 | 0.000200332 |
| 8 | 0.000200332 |
| 9 | 0.000200332 |
| 10 | 0.000200332 |
| 11 | 0.000200332 |
| 12 | 0.000200332 |
| 13 | 0.000200332 |
| 14 | 0.000200332 |
| 15 | 0.000200332 |
| 16 | 0.000200332 |
| 17 | 0.000200332 |
| 18 | 0.000200332 |
| 19 | 0.000200332 |
| 20 | 0.000200332 |
#And I save the profile
我能够获取值变量中的值,但无法设置它。当我明确设置值时,我仍然得到0。谁有人建议为什么?我只是发现该表是使用JavaScript呈现的,它使用HandsOnTable控件。该控件具有特定CSS的文本区域。我正在使用上面的代码来设置它。这是一个文本区域。但仍然是水豚说没有找到该元素。
我看到点击发生在<td>
上。但是我不能设置文字,水豚抱怨它找不到文字区域。
步骤文件在
之下Given /^I specify the following mortality rates:$/ do |mortality_table|
@mortality_data = mortality_table.hashes
@mortality_data.each_with_index do |data, i|
row = first(:xpath, "//div[@id='mortality-table-data']//table/tbody/tr/td[contains(.,'#{data["age"]}')]/..")
row.find(:xpath,"td[2]").click
sleep 3
elem = page.driver.find_element(:css, 'handsontableInput')
puts elem.object_id
end
end
当我执行页面源时,我看到了元素
<div class="handsontableInputHolder htHidden" style="top: 91px; left: 58px; overflow: hidden;"><textarea class="handsontableInput" style="height: 0px; width: 0px;"></textarea></div>