Você está na página 1de 3

#INTERESTS

binder.additionalinsured.where(:Type => ['LP', 'AI']).each do |ai|


puts "losspayees"

if ai.Number == veh.vehNumber #If block 1


#interests menu
puts 'ai.Number: ' + ai.Number.to_s
puts 'veh.vehNumber: ' + veh.vehNumber.to_s

b.button(id:
'ctl00_ctl00_IO_policyMenu_rSubMenu_ctl03_btnMenu').wait_until_present
sleep 0.2
b.button(id: 'ctl00_ctl00_IO_policyMenu_rSubMenu_ctl03_btnMenu').click
#add new

b.link(id:
'ctl00_ctl00_IO_Main_lnkAdd_ioLinkButton').wait_until_present
sleep 0.2
b.link(id: 'ctl00_ctl00_IO_Main_lnkAdd_ioLinkButton').click

b.link(id: 'ctl00_ctl00_IO_Main_lnkAddNew').wait_until_present
sleep 0.2
b.link(id: 'ctl00_ctl00_IO_Main_lnkAddNew').click

#Type drop down


if ai.Type == "LP"
#value="LP"
b.select_list(id:
'ctl00_ctl00_IO_Main_ddlType_ioDropDown').wait_until_present
b.select_list(id:
'ctl00_ctl00_IO_Main_ddlType_ioDropDown').select_value("LP")
sleep 0.5
puts 'LP'
elsif ai.Type == "AI"
#value="AI"
b.select_list(id:
'ctl00_ctl00_IO_Main_ddlType_ioDropDown').wait_until_present
b.select_list(id:
'ctl00_ctl00_IO_Main_ddlType_ioDropDown').select_value("AI")
sleep 0.5
puts 'AI'
end

#CNC ADDRESS
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCName1_ioTextBox').wait_until_present
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCName1_ioTextBox').set ai.Name

b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCName2_ioTextBox').wait_until_present
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCName2_ioTextBox').set ai.name2

b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCAddress1_ioTextBox').wait_until_prese
nt
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_txtCNCAddress1_ioTextBox').set
ai.Address.upcase

if !ai.State.nil?
b.select_list(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_ddlCNCState_ioDropDown').wait_until_present
b.select_list(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_ddlCNCState_ioDropDown').select_value(ai.St
ate.upcase)
else
raise "AdditionalInsured's State is empty"
end
sleep 0.5
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_cntrlCityZip_zpCityZip_zpCityZip_DropDown_i
oComboBox_Input').wait_until_present
b.text_field(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_cntrlCityZip_zpCityZip_zpCityZip_DropDown_i
oComboBox_Input').set ai.Zip
b.send_keys :enter
sleep 0.5
#puts 'before alert'
b.alert.ok if b.alert.exists?
#puts 'after alert'

begin
b.select_list(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_cntrlCityZip_ddlCity_ioDropDown').wait_unti
l_present(10)
uwhelper = Uwhelper.new
uwhelper.citysearch(binder, ai.City.to_s, b.select_list(id:
'ctl00_ctl00_IO_Main_CNCNameAndAddress1_cntrlCityZip_ddlCity_ioDropDown'))
rescue
puts 6.2
end

begin
if b.radio(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_rbDupPartyUseNameEntered_ioRadioButton').exists?
sleep 0.2
b.radio(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_rbDupPartyUseNameEntered_ioRadioButton').set
puts 6.3

b.button(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_btnDupPartyOK_ioButton').wait_until_present
sleep 0.2
b.button(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_btnDupPartyOK_ioButton').click
sleep 2
end
rescue
puts 6.4
end

begin
# NEXT
b.button(id:
'ctl00_ctl00_IO_tabButtons_btnNext_ioButton').wait_until_present 5
b.button(id: 'ctl00_ctl00_IO_tabButtons_btnNext_ioButton').click
rescue
puts 6.5
end

# checks if this insured has already been entered


sleep 0.5
if b.radio(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_rbDupPartyUseNameEntered_ioRadioButton').exists?
sleep 0.2
b.radio(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_rbDupPartyUseNameEntered_ioRadioButton').set
puts 6.75

b.button(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_btnDupPartyOK_ioButton').wait_until_present 5
b.button(id:
'ctl00_ctl00_IO_Main_pnlDuplicate_btnDupPartyOK_ioButton').click
puts 7
end

sleep 0.5
#OK for interest type
b.button(id:
'ctl00_ctl00_IO_Main_popNameType_btnOKNameType_ioButton').wait_until_present 5
b.button(id:
'ctl00_ctl00_IO_Main_popNameType_btnOKNameType_ioButton').click
end #If block 1 Ends Marked by Aashish
end # Interests End Marked by Aashish

Você também pode gostar