sfdc_se 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,499 @@
1
+ # ----------------------------------------------
2
+ # - Page: Field Updates
3
+ # ----------------------------------------------
4
+
5
+ module SfdcSe
6
+ class Driver
7
+
8
+ # -----------------------------
9
+ # click_btn_FieldUpdatesContinue
10
+ # => Clicks the 'Continue' button on the Field Updates page
11
+ #
12
+ def click_btn_FieldUpdatesContinue
13
+ sleep(3)
14
+ @driver.find_element(:xpath => "//input[@class='btn' and @title='Continue']").click
15
+ sleep(3)
16
+ end
17
+ # -----------------------------
18
+
19
+ # -----------------------------
20
+ # click_btn_FieldUpdatesEditCancel
21
+ # => Clicks the 'Cancel' button on the Field Updates Edit page
22
+ #
23
+ def click_btn_FieldUpdatesEditCancel
24
+ @driver.find_element(:xpath => "//td[@id='bottomButtonRow']/input[@class='btn' and @title='Cancel']").click
25
+ end
26
+ # -----------------------------
27
+
28
+ # -----------------------------
29
+ # click_btn_FieldUpdatesEditNew
30
+ # => Clicks the 'New' button on the Field Updates Edit page
31
+ #
32
+ def click_btn_FieldUpdatesEditNew
33
+ @driver.find_element(:xpath => "//input[@class='btn' and @title='New Field Update']").click
34
+ end
35
+ # -----------------------------
36
+
37
+ # -----------------------------
38
+ # click_btn_FieldUpdatesEditSave
39
+ # => Clicks the 'Save' button on the Field Updates Edit page
40
+ #
41
+ def click_btn_FieldUpdatesEditSave
42
+ @driver.find_element(:xpath => "//td[@id='topButtonRow']/input[@class='btn' and @title='Save']").click
43
+
44
+ sMsg=""
45
+ a=@driver.switch_to.alert rescue "Exception happened"
46
+ if !(a == "Exception happened")
47
+ sMsg= "Accepting Alert: #{a.text}"
48
+ a.accept
49
+ end
50
+
51
+ # - Click the 'Bread Crumb' link to return to full Email Alert List View
52
+ @driver.find_element(:xpath => "//div[@class='ptBreadcrumb']/a").click
53
+
54
+ return sMsg
55
+ end
56
+ # -----------------------------
57
+
58
+ # -----------------------------
59
+ # get_FieldUpdatesViewOptions
60
+ # => returns all the elements for the Field Updates dropdown
61
+ #
62
+ def get_FieldUpdatesViewOptions
63
+ return @driver.find_elements(:xpath => "//select[@id='fcf' and @title='View:']/option")
64
+ end
65
+ # -----------------------------
66
+
67
+ # -----------------------------
68
+ # get_FieldUpdatesEdit_IdentificationTable
69
+ # => returns all the elements for the Field Updates Edit Identification Table
70
+ def get_FieldUpdatesEdit_IdentificationTable
71
+ return @driver.find_elements(:xpath => "//h3[contains(.,'Identification')]/../following-sibling::div[1]/table/tbody/tr")
72
+ end
73
+ # -----------------------------
74
+
75
+ # -----------------------------
76
+ # get_FieldUpdatesEdit_SpecifyNewFieldValueTable
77
+ # => returns all the elements for the Field Updates Edit Specify New Field Value Table
78
+ def get_FieldUpdatesEdit_SpecifyNewFieldValueTable
79
+ return @driver.find_elements(:xpath => "//h3[contains(.,'Specify New Field Value')]/../following-sibling::div[1]/table/tbody/tr")
80
+ end
81
+ # -----------------------------
82
+
83
+ # -----------------------------
84
+ # get_FieldUpdatesTable
85
+ # => returns all the elements for the Field Updates Table
86
+ def get_FieldUpdatesTable
87
+ return @driver.find_elements(:xpath => "//table[@class='list']/tbody/tr")
88
+ end
89
+ # -----------------------------
90
+
91
+
92
+ # -----------------------------
93
+ # set_EmailAlerts_View
94
+ # => sViewName = string value of the Sharing Setting option to select
95
+ # => Return = true or false
96
+ # => true = setting of view were successful
97
+ # => false = setting of view had an error
98
+ #
99
+ def set_FieldUpdates_View(sViewName)
100
+ blnViewSet=false
101
+ begin
102
+ get_EmailAlertsViewOptions.each do |option|
103
+ if option.text == sViewName
104
+ option.click unless option.selected?
105
+ blnViewSet=true
106
+ # return blnViewSet
107
+ break
108
+ end
109
+ end
110
+
111
+ # - TODO: Add logic to get all rows on one page
112
+ currentURL=@driver.current_url
113
+ puts "Current URL: #{currentURL}"
114
+ currentURL=@driver.current_url[0..(@drivercurrent_url.index("rowsperpage=")+12)] & "1000" if currentURL.include?("rowsperpage=")
115
+ puts "Updated URL: #{currentURL}"
116
+ rescue
117
+ puts $!
118
+ puts $@
119
+ end
120
+ return blnViewSet
121
+ end
122
+ # -----------------------------
123
+
124
+ # -----------------------------
125
+ # click_Edit_FieldUpdatesTable
126
+ # => sDescriptionName = string value of the Field Updates to click Edit
127
+ # => Return = true or false
128
+ # => true = value was found and 'edit' clicked
129
+ # => false =value was not found or had an error
130
+ #
131
+ def click_Edit_FieldUpdatesTable(sDescriptionName)
132
+ blnEdit=false
133
+ aDescriptionName=sDescriptionName.split("|")
134
+
135
+ r=0
136
+ while r < get_FieldUpdatesTable.length
137
+ if get_FieldUpdatesTable[r].find_element(:xpath => "./th[1]").text == aDescriptionName[0]
138
+ get_FieldUpdatesTable[r].find_element(:xpath => "./td[1]/a[1]").click
139
+ if get_FieldUpdatesEdit_IdentificationTable[1].find_element(:xpath => "./td[2]/div/input").attribute("value") == aDescriptionName[1]
140
+ blnEdit=true
141
+ break
142
+ else
143
+ click_btn_FieldUpdatesEditCancel
144
+ end
145
+ end
146
+ r+=1
147
+ end
148
+
149
+ return blnEdit
150
+ end
151
+ # -----------------------------
152
+
153
+
154
+ # -----------------------------
155
+ # get_FieldUpdates_Configuration
156
+ # => Return = Hash {Key= Field Name/Type, Value=Field Value}
157
+ #
158
+ def get_FieldUpdates_Configuration
159
+ response=Hash.new
160
+
161
+ # - Get 'Identification' section of the Field Update page
162
+ get_FieldUpdatesEdit_IdentificationTable.each_with_index do |row, idx|
163
+ case idx
164
+ when 0,1
165
+ # - 0=Name, 1=Unique Name
166
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value")
167
+ when 2
168
+ # - 2=Description
169
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text
170
+ when 3,4
171
+ # - 3=Object, 4=Field to Update
172
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text
173
+ when 5
174
+ # - 5=Field Data Type
175
+ response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text
176
+ when 6
177
+ # - 6=Re-evaluate Workflow Rules after Field Change; Checkbox
178
+ row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]="false" : response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("checked")
179
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("value")
180
+ end
181
+ end
182
+
183
+ # - Determine the 'Specify New Field Value' section and get configuration
184
+ case response["Field Data Type"]
185
+ when "Picklist"
186
+ # - Picklist Options added to hash
187
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
188
+ row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx|
189
+ case idx
190
+ when 0,1
191
+ response[radiobtns.find_element(:xpath => "./label").text] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil? ).to_s
192
+
193
+ # if radiobtns.find_element(:xpath => "./input").selected?
194
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text
195
+ # end
196
+ when 2
197
+ response[radiobtns.find_element(:xpath => "./div/label").text] = [(!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s, radiobtns.find_element(:xpath => "./div/span/select/option[@selected='selected']").text]
198
+
199
+ # if radiobtns.find_element(:xpath => "./div/input").selected?
200
+ # response[row.find_element(:xpath => "./td[2]/h5").text]="#{radiobtns.find_element(:xpath => "./div/label").text};#{radiobtns.find_element(:xpath => "./div/span/select/option[@selected='selected']").text}"
201
+ # end
202
+ end
203
+ end
204
+ end
205
+ when "Record Type"
206
+ # - Record Type dropdrown added to hash
207
+ response[get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text
208
+ when "Date/Time", "Text", "Text Area", "Date", "Currency", "Phone", "Number", "Long Text Area", "Email", "Fax"
209
+ # - Date Options added to hash; Text Options added to hash
210
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
211
+ row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx|
212
+ case idx
213
+ when 0
214
+ response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s
215
+
216
+ # if radiobtns.find_element(:xpath => "./input").selected?
217
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text
218
+ # end
219
+ when 1
220
+ response[radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")] = [(!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s, radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").text]
221
+
222
+ # if radiobtns.find_element(:xpath => "./div/input").selected?
223
+ # response[row.find_element(:xpath => "./td[2]/h5").text]="#{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")};#{radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").text}"
224
+ # end
225
+ end
226
+ end
227
+ end
228
+ when "Checkbox"
229
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
230
+ row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx|
231
+ response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s
232
+
233
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "") if radiobtns.find_element(:xpath => "./input").attribute("checked")
234
+ end
235
+ end
236
+ when "Lookup"
237
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each_with_index do |row, idx|
238
+ case idx
239
+ when 0
240
+ # - Do nothing, blank row
241
+ when 1
242
+ # - Text Box (Lookup) Field
243
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/span/input").attribute("value")
244
+ when 2
245
+ # - Checkbox
246
+ response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = (!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s
247
+ end
248
+ end
249
+ end
250
+
251
+ return response
252
+ end
253
+ # -----------------------------
254
+
255
+ # -----------------------------
256
+ # set_FieldUpdates_Configuration
257
+ # => sObjName = string value of the object to set
258
+ # => hObjValues = Values to set, Hash {Field, Value}
259
+ # => addnew = Boolean, defaults to false unless true is passed
260
+ # - Set to true to create a new Email Alert (rather then adjusting the configuration of an existing one)
261
+ # => return = true/false
262
+ # - True = Configuration was updated
263
+ # - False = Configration was NOT updated
264
+ #
265
+ def set_FieldUpdates_Configuration(sObjName, hObjValues, addnew=false)
266
+ addnew=false unless addnew==true
267
+ blnUpdateReturn=false
268
+ r=0
269
+ @driver.manage.timeouts.implicit_wait = 0
270
+
271
+ # - Get 'Identification' section of the Field Update page
272
+ while r < get_FieldUpdatesEdit_IdentificationTable.length
273
+ # get_FieldUpdatesEdit_IdentificationTable.each_with_index do |row, idx|
274
+ case r
275
+ when 0,1
276
+ # - 0=Name, 1=Unique Name
277
+ if !(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/div/input").attribute("value"))
278
+ get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/div/input").clear()
279
+ get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/div/input").send_keys(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
280
+ puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
281
+ blnUpdateReturn=true
282
+ end
283
+
284
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value")
285
+ when 2
286
+ # - 2=Description
287
+ if !(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/textarea").text)
288
+ get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/textarea").clear()
289
+ get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/textarea").send_keys(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
290
+ puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
291
+ blnUpdateReturn=true
292
+ end
293
+
294
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text
295
+ when 3,4
296
+ # - 3=Object, 4=Field to Update
297
+ # - Object
298
+ if addnew
299
+ if get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[1]//*").size == 0
300
+ # - Row has multiple dropdown selections
301
+ aFieldToUpdate=hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")].split(": ")
302
+ aFieldToUpdate.each_with_index do |aFieldSelection, idx|
303
+ if idx == 0
304
+ aDropdownLists=get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select[#{idx+1}]/option")
305
+ else
306
+ aDropdownLists=get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select[#{idx+1}]/optgroup/option")
307
+ end
308
+ aDropdownLists.each do |option|
309
+ if option.text == aFieldSelection
310
+ option.click unless option.selected?
311
+ sleep(5)
312
+ puts "Updated Field: #{aFieldSelection}"
313
+ blnUpdateReturn=true
314
+ break
315
+ end
316
+ end
317
+ end
318
+ else
319
+ # - Row has single dropdown seletion
320
+ get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option|
321
+ if option.text == hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]
322
+ option.click unless option.selected?
323
+ sleep(5)
324
+ puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
325
+ blnUpdateReturn=true
326
+ break
327
+ end
328
+ end
329
+ end
330
+ end
331
+
332
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text
333
+ when 5
334
+ # - 5=Field Data Type
335
+ $sFldDataType=get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]").text
336
+
337
+ # response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text
338
+ when 6
339
+ # - 6=Re-evaluate Workflow Rules after Field Change; Checkbox
340
+ checkboxStatus=get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? "false" : "true"
341
+ if !(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == checkboxStatus)
342
+ get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/input").click
343
+ puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
344
+ blnUpdateReturn=true
345
+ end
346
+
347
+ # row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]="false" : response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("checked")
348
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("value")
349
+ end
350
+
351
+ r+=1
352
+ end
353
+
354
+ # - Determine the 'Specify New Field Value' section and set configuration
355
+ case $sFldDataType
356
+ when "Picklist"
357
+ # - Picklist Options added to hash
358
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
359
+ row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx|
360
+ case idx
361
+ when 0,1
362
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s)
363
+ radiobtns.find_element(:xpath => "./input").click
364
+ puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}"
365
+ blnUpdateReturn=true
366
+ end
367
+
368
+ # response[radiobtns.find_element(:xpath => "./label").text] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil? ).to_s
369
+
370
+ # if radiobtns.find_element(:xpath => "./input").selected?
371
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text
372
+ # end
373
+ when 2
374
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][0] == (!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s)
375
+ radiobtns.find_element(:xpath => "./div/input").click
376
+ radiobtns.find_elements(:xpath => "./div/span/select/option").each do |option|
377
+ if option.text == hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1]
378
+ puts "Updated Dropdown Value To: #{option.text}" unless option.selected?
379
+ option.click unless option.selected?
380
+ end
381
+ end
382
+ puts "Updated Field: #{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")}"
383
+ blnUpdateReturn=true
384
+ end
385
+
386
+ # response[radiobtns.find_element(:xpath => "./div/label").text] = [(!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s, radiobtns.find_element(:xpath => "./div/span/select/option[@selected='selected']").text]
387
+
388
+ # if radiobtns.find_element(:xpath => "./div/input").selected?
389
+ # response[row.find_element(:xpath => "./td[2]/h5").text]="#{radiobtns.find_element(:xpath => "./div/label").text};#{radiobtns.find_element(:xpath => "./div/span/select/option[@selected='selected']").text}"
390
+ # end
391
+ end
392
+ end
393
+ end
394
+ when "Record Type"
395
+ # - Record Type dropdrown added to hash
396
+ if !(hObjValues[sObjName][get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text)
397
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_elements(:xpath => "./td[2]/div/select/option").each do |option|
398
+ if option.text == hObjValues[sObjName][get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]
399
+ puts "Updated Dropdown Value To: #{option.text}" unless option.selected?
400
+ option.click unless option.selected?
401
+ blnUpdateReturn=true
402
+ end
403
+ end
404
+ end
405
+
406
+ # response[get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text
407
+ when "Date/Time", "Text", "Text Area", "Date", "Currency", "Phone", "Number", "Long Text Area", "Email", "Fax"
408
+ # - Date Options added to hash; Text Options added to hash
409
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
410
+ row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx|
411
+ case idx
412
+ when 0
413
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s)
414
+ radiobtns.find_element(:xpath => "./input").click
415
+ puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}"
416
+ blnUpdateReturn=true
417
+ end
418
+
419
+ # response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s
420
+
421
+ # if radiobtns.find_element(:xpath => "./input").selected?
422
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text
423
+ # end
424
+ when 1
425
+ #- Validate Radio Button and then Dropdown Value
426
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][0] == (!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s)
427
+ radiobtns.find_element(:xpath => "./div/input").click
428
+ puts "Upated Field: #{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")}"
429
+ blnUpdateReturn=true
430
+ end
431
+ if !radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?
432
+ puts "Formula Value - JSON: #{hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1]}"
433
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1] == radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").text)
434
+ radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").clear()
435
+ radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").send_keys(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1])
436
+ puts "Updated Text/Formula To : #{hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1]}"
437
+ blnUpdateReturn=true
438
+ end
439
+ end
440
+
441
+ # response[radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")] = [(!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s, radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").text]
442
+
443
+ # if radiobtns.find_element(:xpath => "./div/input").selected?
444
+ # response[row.find_element(:xpath => "./td[2]/h5").text]="#{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")};#{radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").text}"
445
+ # end
446
+ end
447
+ end
448
+ end
449
+ when "Checkbox"
450
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row|
451
+ row.find_elements(:xpath => "./td[2]/ul/li").each do |radiobtns|
452
+ if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s)
453
+ radiobtns.find_element(:xpath => "./input").attribute("checked").click
454
+ puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}"
455
+ blnUpdateReturn=true
456
+ end
457
+
458
+ # response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s
459
+
460
+ # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "") if radiobtns.find_element(:xpath => "./input").attribute("checked")
461
+ end
462
+ end
463
+ when "Lookup"
464
+ get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each_with_index do |row, idx|
465
+ case idx
466
+ when 0
467
+ # - Do nothing, blank row
468
+ when 1
469
+ # - Text Box (Lookup) Field
470
+ # -########################################
471
+ if !(hObjValues[sObjName][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == row.find_element(:xpath => "./td[2]/div/span/input").attribute("value"))
472
+ row.find_element(:xpath => "./td[2]/div/span/input").clear()
473
+ row.find_element(:xpath => "./td[2]/div/span/input").send_keys(hObjValues[sObjName][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")])
474
+ puts "Updated Field: #{row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
475
+ blnUpdateReturn=true
476
+ end
477
+
478
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/span/input").attribute("value")
479
+ when 2
480
+ # - Checkbox
481
+ if !(hObjValues[sObjName][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == (!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s)
482
+ row.find_element(:xpath => "./td[2]/input").click
483
+ puts "Update Field: #{row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}"
484
+ blnUpdateReturn=true
485
+ end
486
+
487
+ # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = (!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s
488
+ end
489
+ end
490
+ end
491
+
492
+ # return response
493
+ @driver.manage.timeouts.implicit_wait = @implicitWait
494
+ return blnUpdateReturn
495
+ end
496
+ # -----------------------------
497
+
498
+ end
499
+ end