class SfdcSe::Driver
Public Class Methods
initialize
> opts:¶ ↑
> :browserName = firefox, Chrome, etc (currently only providen for FF, default value)¶ ↑
> :implicitWaitSec = the time out for implicit waits in secs; 30 sec default value¶ ↑
> :explicitWaitSec = the time out for explicit waits in secs; 30 sec default value¶ ↑
# File lib/sfdc_se.rb, line 29 def initialize(opts = {}) @browser=opts[:browserName] || 'firefox'.to_sym if @browser.is_a? String @browser.to_sym end @implicitWait=opts[:implicitWaitSec] || 30 if !@implicitWait.is_a?(Numeric) @implicitWait.to_i end @explicitWait=opts[:explicitWaitSec] || 30 if !@explicitWait.is_a?(Numeric) @explicitWait.to_i end @driver = Selenium::WebDriver.for @browser @driver.manage.window.maximize @driver.manage.timeouts.implicit_wait = @implicitWait setExplicitWait @explicitWait return @driver end
Public Instance Methods
# File lib/sfdc_se/pages/page_template.rb, line 8 def click_<name> # -- <description> @driver.find_element(:id => '<id value>').click end
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 55 def click_Btn_ChangePassword @driver.find_element(:id => 'password-button').click end
click_Btn_DeliverabilitySave
> Clicks the 'save' button and waits for the Success text message to be displayed¶ ↑
# File lib/sfdc_se/pages/page_deliverability.rb, line 12 def click_Btn_Deliverability_Save # -- Clicks the 'Save' button @driver.find_element(:id => "thePage:theForm:editBlock:buttons:saveBtn").click # -- Waits for the confirmation that the save was successful wait.until{@driver.find_element(:id => "thePage:theForm:successText").displayed?} end
click_Btn_HomePageLayouts_EditAssignment
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 21 def click_Btn_HomePageLayouts_EditAssignment @driver.find_element(:xpath => "//input[@title = 'Edit Assignment']").click sleep(3) end
click_Btn_HomePageLayouts_PageLayoutAssignment
> Clicks the 'Home Page Layouts' button ¶ ↑
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 13 def click_Btn_HomePageLayouts_PageLayoutAssignment @driver.find_element(:xpath => "//input[@title='Page Layout Assignment']").click sleep(3) end
click_Btn_HomePageLayouts_save
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 29 def click_Btn_HomePageLayouts_save @driver.find_element(:xpath => "//td[@id = 'topButtonRow']/input[@title='Save']").click return @driver.find_element(:xpath => "//input[@title = 'Edit Assignment']").displayed? end
click_Btn_RenameTabslabels_Cancel
> Clicks the 'Cancel' button within the Rename Tabs and Labels¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 149 def click_Btn_RenameTabslabels_Cancel @driver.find_element(:xpath => "//div[@class='pbTopButtons']/input[@class='btnCancel']").click end
click_Btn_RenameTabslabels_Next
> Clicks the 'Next' button within the Rename Tabs and Labels¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 166 def click_Btn_RenameTabslabels_Next @driver.find_element(:xpath => "//div[@class='pbTopButtons']/input[@class='btn' and @title='Next']").click end
click_Btn_RenameTabslabels_Save
> Clicks the 'Save' button within the Rename Tabs and Labels¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 158 def click_Btn_RenameTabslabels_Save @driver.find_element(:xpath => "//div[@class='pbTopButtons']/input[@class='btn' and @title='Save']").click end
click_Btn_SharingSettingsAccess_Edit
> clicks the Edit button on the Sharing Setting Access Page¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 36 def click_Btn_SharingSettingsAccess_Edit @driver.find_element(:xpath => "//input[@title = 'Edit' and @class='btn']").click end
click_Btn_SharingSettingsAccess_Save
> clicks the Save button on the Sharing Setting Access Page¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 45 def click_Btn_SharingSettingsAccess_Save sMsg="" @driver.find_element(:xpath => "//input[@title = 'Save' and @class='btn']").click a= @driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") if a.text.include? "All sharing rules will be recalculated based on the new defaults" sMsg= "Accepting Alert: #{a.text}" a.accept else sMsg= "NOT Accepting Alert: #{a.text}" a.dismiss end end return sMsg end
click_Btn_SharingSettingsAccess_SavePrompt_OK
> clicks the Save button on the Sharing Setting Access Page¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 67 def click_Btn_SharingSettingsAccess_SavePrompt_OK cWindowHandle=@driver.window_handle puts "Current Window Handle: #{cWindowHandle}" puts "Open Windoes of browser: #{@driver.window_handles}" @driver.window_handles.each do |win| if !(win == cWindowHandle) @driver.switch_to(win) @driver.action.send_keys("\n").perform @driver.switch_to(cWindowHandle) end end end
> sDescriptionName = string value of the Email Alert to click Edit¶ ↑
> Return = true or false¶ ↑
> true = value was found and 'edit' clicked¶ ↑
> false =value was not found or had an error¶ ↑
# File lib/sfdc_se/pages/page_emailalerts.rb, line 114 def click_Edit_EmailAlertsTable(sDescriptionName) blnEdit=false get_EmailAlertsTable.each do |row| if row.find_element(:xpath => "./th[1]").text == sDescriptionName row.find_element(:xpath => "./td[1]/a[1]").click blnEdit=true break end end return blnEdit end
> sDescriptionName = string value of the Field Updates to click Edit¶ ↑
> Return = true or false¶ ↑
> true = value was found and 'edit' clicked¶ ↑
> false =value was not found or had an error¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 131 def click_Edit_FieldUpdatesTable(sDescriptionName) blnEdit=false aDescriptionName=sDescriptionName.split("|") r=0 while r < get_FieldUpdatesTable.length if get_FieldUpdatesTable[r].find_element(:xpath => "./th[1]").text == aDescriptionName[0] get_FieldUpdatesTable[r].find_element(:xpath => "./td[1]/a[1]").click if get_FieldUpdatesEdit_IdentificationTable[1].find_element(:xpath => "./td[2]/div/input").attribute("value") == aDescriptionName[1] blnEdit=true break else click_btn_FieldUpdatesEditCancel end end r+=1 end return blnEdit end
> sTabName = string value of the Tab Name to click Edit¶ ↑
> Return = true or false¶ ↑
> true = value was found and 'edit' clicked¶ ↑
> false =value was not found or had an error¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 107 def click_Edit_RenameTabsLabels(sTabName) blnEdit=false sFoundIn='empty' r=0 puts "Standard Rows: #{get_RenameTabsLabels_StandardTable.length}" while r < get_RenameTabsLabels_StandardTable.length $stdout.flush print "\r#{r} of #{get_RenameTabsLabels_StandardTable.length} - Standard:: #{get_RenameTabsLabels_StandardTable[r].find_element(:xpath => "./th[1]").text}" if get_RenameTabsLabels_StandardTable[r].find_element(:xpath => "./th[1]").text == sTabName get_RenameTabsLabels_StandardTable[r].find_element(:xpath => "./td[1]/a[1]").click sleep(5) sFoundIn='standard' blnEdit=true break end r+=1 end r=0 puts "" puts "Custom Rows: #{get_RenameTabsLabels_CustomTable.length}" while r < get_RenameTabsLabels_CustomTable.length print "\r#{r} of #{get_RenameTabsLabels_CustomTable.length} - Custom:: #{get_RenameTabsLabels_CustomTable[r].find_element(:xpath => "./th[1]").text}" if get_RenameTabsLabels_CustomTable[r].find_element(:xpath => "./th[1]").text == sTabName get_RenameTabsLabels_CustomTable[r].find_element(:xpath => "./td[1]/a[1]").click sleep(5) sFoundIn='custom' blnEdit=true break end r+=1 end print "\r #{blnEdit}, #{sFoundIn}" return blnEdit, sFoundIn end
click_EmailAdministration_Deliverability
> Clicks the Deliverability link under Email Administration from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 247 def click_EmailAdministration_Deliverability # -- Click the 'Deliverability' from the Setup Nav Bar @driver.find_element(:id => 'OrgEmailSettings_font').click end
click_EmailAdministration_icon
> Clicks the arrow icon for Email Administration from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 237 def click_EmailAdministration_icon # -- Click the 'arrow icon' for Email Administration from Setup Nav Bar @driver.find_element(:id => 'EmailAdmin_icon').click if @driver.find_element(:id => 'EmailAdmin').attribute("class") == "parent" end
click_MyPersonalInformation_PersonalInformation
> Clicks the Personal Information link under My Personal Information from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 33 def click_MyPersonalInformation_PersonalInformation @driver.find_element(:id => 'PersonalInformation_font').click end
click_MyPersonalInformation_icon
> Clicks the arrow icon for 'My Personal Information' from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 17 def click_MyPersonalInformation_icon @driver.find_element(:id => 'PersonalInfo_icon').click if @driver.find_element(:id => 'PersonalInfo').attribute("class") == "parent" end
click_Profiles_ApexClassAccess_Edit
> clicks the 'edit' button within the Apex Class Access section¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 161 def click_Profiles_ApexClassAccess_Edit @driver.find_element(:xpath => "//h3[contains(.,'Enabled Apex Class Access')]/../following-sibling::td[1]/input[@class='btn' and @title='Edit']").click # @driver.find_element(:xpath => "//div[@class='ptBreadcrumb']/a").click # @wait.until{@driver.find_element(:xpath => "//input[@class='btn' and @title='New Profile']")} end
click_Profiles_VisualforcePageAccess_Edit
> clicks the 'edit' button within the Visualforce Page Access section¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 171 def click_Profiles_VisualforcePageAccess_Edit @driver.find_element(:xpath => "//h3[contains(.,'Enabled Visualforce Page Access')]/../following-sibling::td[1]/input[@class='btn' and @title='Edit']").click end
click_RenameTabsLabels_TabNamesLabels
> Clicks the link for Rename Tabs and Labels from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 182 def click_RenameTabsLabels_TabNamesLabels @driver.find_element(:id => "RenameTab_font").click end
> Clicks the arrow icon for Security Controls under Administrative Setup from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 267 def click_SecurityControls_arrow @driver.find_element(:id => 'Security_icon').click if @driver.find_element(:id => 'Security').attribute("class") == "parent" end
click_SharingSettings_SecurityControls
> Clicks the Sharing Settings link under Security Controls from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 276 def click_SharingSettings_SecurityControls @driver.find_element(:id => 'SecuritySharing_font').click end
click_Translate_TranslationWorkbench
> Clicks the Translate link under Translation Workbench from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 305 def click_Translate_TranslationWorkbench @driver.find_element(:id => 'LabelWorkbenchTranslate_font').click end
click_TranslationWorkbench_arrow
> Clicks the arrow icon for Translations Workbench under Administrative Setup from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 295 def click_TranslationWorkbench_arrow # @driver.find_element(:id => 'LabelWorkbench_icon').click if @driver.find_element(:id => 'LabelWorkbench').attribute("class") == "parent" @driver.find_element(:id => 'LabelWorkbench_icon').click if @driver.find_element(:xpath => "//a[@id='LabelWorkbench_icon']/img").attribute("title").include? "Expand" end
> Clicks the arrow icon for Workflow & Approvals from the Setup Menu¶ ↑
# File lib/sfdc_se/pages/page_setup.rb, line 124 def click_WorkflowApprovals_icon @driver.find_element(:id => "Workflow_icon").click if @driver.find_element(:xpath => "//a[@id='Workflow_icon']/img").attribute("title").include? "Expand" end
> Clicks the 'Save' button on the Email Alerts Edit page¶ ↑
# File lib/sfdc_se/pages/page_emailalerts.rb, line 30 def click_btn_EmailAlertEditSave # - Click the Save button and handle Alert if prompted; always Accept. @driver.find_element(:xpath => "//td[@id='topButtonRow']/input[@class='btn' and @title='Save']").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end # - Click the 'Bread Crumb' link to return to full Email Alert List View @driver.find_element(:xpath => "//div[@class='ptBreadcrumb']/a").click # - Return Text from Alert, if present return sMsg end
click_btn_EmailAlertsEditCancel
> Clicks the 'Cancle' button on the Email Alerts Edit page¶ ↑
# File lib/sfdc_se/pages/page_emailalerts.rb, line 21 def click_btn_EmailAlertsEditCancel @driver.find_element(:xpath => "//td[@id='bottomButtonRow']/input[@class='btn' and @title='Cancel']").click end
click_btn_FieldUpdatesContinue
> Clicks the 'Continue' button on the Field Updates page¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 12 def click_btn_FieldUpdatesContinue sleep(3) @driver.find_element(:xpath => "//input[@class='btn' and @title='Continue']").click sleep(3) end
click_btn_FieldUpdatesEditCancel
> Clicks the 'Cancel' button on the Field Updates Edit page¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 23 def click_btn_FieldUpdatesEditCancel @driver.find_element(:xpath => "//td[@id='bottomButtonRow']/input[@class='btn' and @title='Cancel']").click end
click_btn_FieldUpdatesEditSave
> Clicks the 'Save' button on the Field Updates Edit page¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 41 def click_btn_FieldUpdatesEditSave @driver.find_element(:xpath => "//td[@id='topButtonRow']/input[@class='btn' and @title='Save']").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end # - Click the 'Bread Crumb' link to return to full Email Alert List View @driver.find_element(:xpath => "//div[@class='ptBreadcrumb']/a").click return sMsg end
click_btn_Profiles_ApexClassAccess_Add
# File lib/sfdc_se/pages/page_profiles.rb, line 144 def click_btn_Profiles_ApexClassAccess_Add @driver.find_element(:xpath => "//img[@class='rightArrowIcon' and @title='Add']").click end
click_btn_Profiles_ApexClassAccess_Cancel
# File lib/sfdc_se/pages/page_profiles.rb, line 185 def click_btn_Profiles_ApexClassAccess_Cancel @driver.find_element(:xpath => "//input[@class='btn' and @title='Cancel']").click end
click_btn_Profiles_ApexClassAccess_Save
# File lib/sfdc_se/pages/page_profiles.rb, line 178 def click_btn_Profiles_ApexClassAccess_Save @driver.find_element(:xpath => "//input[@class='btn' and @title='Save']").click end
# File lib/sfdc_se/pages/page_profiles.rb, line 137 def click_btn_Profiles_Cancel @driver.find_element(:xpath => "//input[@class='btn' and @title='Cancel']").click end
# File lib/sfdc_se/pages/page_profiles.rb, line 114 def click_btn_Profiles_Edit @driver.find_element(:xpath => "//input[@class='btn' and @title='Edit']").click end
# File lib/sfdc_se/pages/page_profiles.rb, line 121 def click_btn_Profiles_Save @driver.find_element(:xpath => "//input[@class='btn' and @title='Save']").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end return sMsg end
# File lib/sfdc_se/pages/page_translate.rb, line 65 def click_btn_Translate_Save @driver.find_element(:xpath => "//table[@id = 'saveBtn']/tbody/tr[2]/td[2]/em/button").click sleep(5) end
close
# File lib/sfdc_se.rb, line 101 def close @driver.quit end
Translation Abbreviation Converter
# File lib/sfdc_se.rb, line 117 def convert_LanguageAbbreviation(sLanguageAbbrevation) case sLanguageAbbrevation when "zh_CN" return "Chinese (Simplified)" when "zh_TW" return "Chinese (Traditional)" when "da" return "Danish" when "nl_NL" return "Dutch" when "en_US" return "English" when "fi" return "Finnish" when "fr" return "French" when "de" return "German" when "it" return "Italian" when "ja" return "Japanese" when "ko" return "Korean" when "no" return "Norwegian" when "pt_BR" return "Portuguese (Brazilian)" when "ru" return "Russian" when "es" return "Spanish" when "es_MX" return "Spanish (Mexican)" when "sv" return "Swedish" when "th" return "Thai" when "ar" return "Arabic" when "bg" return "Bulgarian" when "hr" return "Croatian" when "cs" return "Czech" when "en_GB" return "English (UK)" when "el" return "Greek" when "iw" return "Hebrew" when "hu" return "Hungarian" when "in" return "Indonesian" when "pl" return "Polish" when "pt_PT" return "Portuguese (European)" when "ro" return "Romanian" when "sk" return "Slovak" when "sl" return "Slovene" when "tr" return "Turkish" when "uk" return "Ukrainian" when "vi" return "Vietnamese" end end
get_CurrentSelection_AccessLevel
> returns the currently selected value¶ ↑
# File lib/sfdc_se/pages/page_deliverability.rb, line 30 def get_CurrentSelection_Devliverability_AccessLevel # -- Deliverability > Access to Send Email > Access Level options=get_elements_Devliverability_AccessLevel options.each do |option| if option.selected? return option.text end end end
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_emailalerts.rb, line 131 def get_EmailAlert_Configuration response=Hash.new get_EmailAlertsEditTable.each_with_index do |row, idx| case idx when 0,1 # 0 = Description, 1 = Uniique Name response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 when 2 # - 2 = Object response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text when 4, 7, 8 # - 4,7 = Blank Row, 8 = Text, no configurable item # - Do nothing, row not required when 3 # - 3 = Email Template response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/span/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 when 5 # - 5 = Recipient Type $sSearchOpt=row.find_element(:xpath => "./td[2]/div/select/option[@selected='']").text $sForField=row.find_element(:xpath => "./td[2]/div/input[@id='searchValue_userFilter']").attribute("value") response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]="#{$sSearchOpt};#{$sForField}" when 6 # - 6 = Recipents # - Get Selected Recipients $aSelected=[] row.find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |sr| $aSelected.push(sr.text) end response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=$aSelected when 9 # - 9 = Additional Emails response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text when 10 # - 10 = From Email Address response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 11 # - 11 = Checkbox; Make this address the default From email address for this object's email alerts row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? response[row.find_element(:xpath => "./td[2]/label").text]="false" : response[row.find_element(:xpath => "./td[2]/label").text]=row.find_element(:xpath => "./td[2]/input").attribute("checked") # response[row.find_element(:xpath => "./td[2]/label").text]=row.find_element(:xpath => "./td[2]/input").attribute("value") end end return response end
get_FieldUpdatesEdit_IdentificationTable
> returns all the elements for the Field Updates Edit Identification Table¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 70 def get_FieldUpdatesEdit_IdentificationTable return @driver.find_elements(:xpath => "//h3[contains(.,'Identification')]/../following-sibling::div[1]/table/tbody/tr") end
get_FieldUpdatesEdit_SpecifyNewFieldValueTable
> returns all the elements for the Field Updates Edit Specify New Field Value Table¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 78 def get_FieldUpdatesEdit_SpecifyNewFieldValueTable return @driver.find_elements(:xpath => "//h3[contains(.,'Specify New Field Value')]/../following-sibling::div[1]/table/tbody/tr") end
get_FieldUpdates_Configuration
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 158 def get_FieldUpdates_Configuration response=Hash.new # - Get 'Identification' section of the Field Update page get_FieldUpdatesEdit_IdentificationTable.each_with_index do |row, idx| case idx when 0,1 # - 0=Name, 1=Unique Name response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 2 # - 2=Description response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text when 3,4 # - 3=Object, 4=Field to Update response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text when 5 # - 5=Field Data Type response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text when 6 # - 6=Re-evaluate Workflow Rules after Field Change; Checkbox 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") # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("value") end end # - Determine the 'Specify New Field Value' section and get configuration case response["Field Data Type"] when "Picklist" # - Picklist Options added to hash get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx| case idx when 0,1 response[radiobtns.find_element(:xpath => "./label").text] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil? ).to_s # if radiobtns.find_element(:xpath => "./input").selected? # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text # end when 2 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] # if radiobtns.find_element(:xpath => "./div/input").selected? # 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}" # end end end end when "Record Type" # - Record Type dropdrown added to hash 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 when "Date/Time", "Text", "Text Area", "Date", "Currency", "Phone", "Number", "Long Text Area", "Email", "Fax" # - Date Options added to hash; Text Options added to hash get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx| case idx when 0 response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s # if radiobtns.find_element(:xpath => "./input").selected? # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text # end when 1 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] # if radiobtns.find_element(:xpath => "./div/input").selected? # 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}" # end end end end when "Checkbox" get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx| response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s # 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") end end when "Lookup" get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each_with_index do |row, idx| case idx when 0 # - Do nothing, blank row when 1 # - Text Box (Lookup) Field response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/span/input").attribute("value") when 2 # - Checkbox response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = (!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s end end end return response end
get_HomePageLayouts_Profile_Assignments
> Returns a hash; Key = Profile Name, Value = Page Layout Assignment¶ ↑
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 45 def get_HomePageLayouts_Profile_Assignments hProfiles=Hash.new get_elements_HomePageLayouts_Profiles_table.each do |row| hProfiles[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text end return hProfiles end
get_LocaleSidKey
(blnSandbox, sUserName, sPassword)
> Returns the Org LocaleSidKey¶ ↑
# File lib/sfdc_se/general/general.rb, line 30 def get_LocaleSidKey(blnSandbox, sUserName, sPassword) ENV['http_proxy']='http://webproxy.merck.com:8080' ENV['https_proxy']='https://webproxy.merck.com:8080' client=restforce_client({:sandbox => blnSandbox, :username => sUserName, :password => sPassword}) resp_SOQL=client.query("SELECT LocaleSidKey FROM User WHERE Username = '#{sUserName}'") if resp_SOQL.size == 1 resp_SOQL.each do |r| return r['LocaleSidKey'] end end ENV.delete('HTTP_PROXY') ENV.delete('HTTPS_PROXY') end
get_PersonalInformation_username
> Returns the Username value¶ ↑
# File lib/sfdc_se/pages/page_personalinformation.rb, line 13 def get_PersonalInformation_username return @driver.find_element(:xpath => "//table[@class='detailList']/tbody/tr[4]/td[2]").text end
get_Profile_VisualforcePageAccess_EnabledSelect
> returns all the options for the Availalble Apex Classes¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 106 def get_Profile_VisualforcePageAccess_EnabledSelect return @driver.find_elements(:xpath => "//select[@id='duel_select_1']/option") end
get_Profiles_AdministrativePermissions
> Returns a hash; Key = Permission Name, Value = Checked/Unchecked¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 244 def get_Profiles_AdministrativePermissions begin @aPAP=Hash.new if get_Profiles_CustomProfile_CheckboxValue get_Profiles_AdministrativePermissions_table.each do |i| @aPAP[i.find_element(:xpath => "./td[1]").text]=i.find_element(:xpath => "./td[2]/img").attribute("alt") @aPAP[i.find_element(:xpath => "./td[3]").text]=i.find_element(:xpath => "./td[4]/img").attribute("alt") unless i.find_element(:xpath => "./td[3]").attribute("class") == "labelCol last empty" end end return @aPAP rescue puts $! puts $@ end end
get_Profiles_AdministrativePermissions_table
> returns all the elements for the Profiles Administravite Permissions table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 27 def get_Profiles_AdministrativePermissions_table return @driver.find_elements(:xpath => "//h3[contains(.,'Administrative Permissions')]/../following-sibling::div[1]/table/tbody/tr") end
> Returns an Array; [ApexClassAccess1, ApexClassAccess2]¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 656 def get_Profiles_ApexClassAccess @driver.manage.timeouts.implicit_wait = 0 begin aResponse=[] if get_Profiles_CustomProfile_CheckboxValue puts "Apex Class Access Row Count: #{get_Profiles_ApexClassAccess_table.size}" get_Profiles_ApexClassAccess_table.each do |row| # puts "Row Class Value: #{row.attribute("class")}" aResponse.push(row.find_element(:xpath => "./th[1]/a").text) unless row.attribute('class')=='headerRow' end end @driver.manage.timeouts.implicit_wait = @implicitWait return aResponse rescue puts $! puts $@ ensure @driver.manage.timeouts.implicit_wait = @implicitWait end end
get_Profiles_ApexClassAccess_AvailableSelect
> returns all the options for the Availalble Apex Classes¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 98 def get_Profiles_ApexClassAccess_AvailableSelect return @driver.find_elements(:xpath => "//select[@id='duel_select_0']/option") end
get_Profiles_ApexClassAccess_table
> returns all the elements for the Profiles Apex Class Access table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 82 def get_Profiles_ApexClassAccess_table return @driver.find_elements(:xpath => "//h3[contains(.,'Enabled Apex Class Access')]/../../../../../following-sibling::div[1]/table/tbody/tr") end
get_Profiles_CustomObjectPermissions
> Returns an Nested Hash; {Object Name =>{Key = Header Name, Value = Checked/Unchecked}}¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 544 def get_Profiles_CustomObjectPermissions @driver.manage.timeouts.implicit_wait = 0 begin @aCOP_Headers=[] response_hash = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc) } if get_Profiles_CustomProfile_CheckboxValue get_Profiles_CustomObjectPermissions_table.each_with_index do |row, index| if index == 0 row.find_elements(:xpath => "./td[2]/table/tbody/tr[2]/th").each do |header| @aCOP_Headers.push(header.text.strip! || header.text) end else # -- Left Column of Table $tempObjectName_Left=row.find_element(:xpath => "./th[1]").text row.find_elements(:xpath => "./td[1]/table/tbody/tr/td").each_with_index do |hv, idx| # puts "Main Table Index: #{index}; Left Column Index: #{idx}" print "\rMain Table Index: #{index}; Left Column Index: #{idx}" response_hash[$tempObjectName_Left][@aCOP_Headers[idx]]=hv.find_element(:xpath => "./img").attribute("alt") unless hv.find_elements(:xpath => ".//*").size == 0 end # -- Right Column of Table if row.find_element(:xpath => "./td[2]").attribute("class") != "labelCol last empty" $tempObjectName_Right=row.find_element(:xpath => "./th[2]").text row.find_elements(:xpath => "./td[2]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size != 0 # puts "Main Table Index: #{index}; Right Column Index: #{idx}" print "\rMain Table Index: #{index}; Right Column Index: #{idx}" response_hash[$tempObjectName_Right][@aCOP_Headers[idx]]=hv.find_element(:xpath => "./img").attribute("alt") #unless hv.find_elements(:xpath => ".//*").size == 0 end end end end end end @driver.manage.timeouts.implicit_wait = @implicitWait return response_hash rescue puts $! puts $@ ensure puts " " @driver.manage.timeouts.implicit_wait = @implicitWait end end
get_Profiles_CusomObjectPermissions_table
> returns all the elements for the Profiles Custom Object Permissions table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 51 def get_Profiles_CustomObjectPermissions_table return @driver.find_elements(:xpath => "//h3[contains(.,'Custom Object Permissions')]/../following-sibling::div[1]/table/tbody/tr") end
get_Profiles_CustomProfile_CheckboxValue
> Returns true/false¶ ↑
True = Custom Profile Checkbox is checked False = Custom Profile Checkbox is NOT checked
# File lib/sfdc_se/pages/page_profiles.rb, line 74 def get_Profiles_CustomProfile_CheckboxValue return @driver.find_element(:xpath => "//td[contains(.,'Custom Profile')]/following-sibling::td/img").attribute("title")=='Checked' ? true : false end
get_Profiles_GeneralUserPermissions
> Returns a hash; Key = Permission Name, Value = Checked/Unchecked¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 301 def get_Profiles_GeneralUserPermissions begin @aConfig=Hash.new if get_Profiles_CustomProfile_CheckboxValue get_Profiles_GeneralUserPermissions_table.each do |row| @aConfig[row.find_element(:xpath => "./td[1]").text]=row.find_element(:xpath => "./td[2]/img").attribute("alt") @aConfig[row.find_element(:xpath => "./td[3]").text]=row.find_element(:xpath => "./td[4]/img").attribute("alt") unless row.find_element(:xpath => "./td[3]").attribute("class") == "labelCol last empty" end end return @aConfig rescue puts $! puts $@ end end
get_Profiles_GeneralUserPermissions_table
> returns all the elements for the Profiles General User Permissions table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 35 def get_Profiles_GeneralUserPermissions_table return @driver.find_elements(:xpath => "//h3[contains(.,'General User Permissions')]/../following-sibling::div[1]/table/tbody/tr") end
get_Profiles_StandardObjectPermissions
> Returns an Nested Hash; {Object Name =>{Key = Header Name, Value = Checked/Unchecked}}¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 437 def get_Profiles_StandardObjectPermissions @driver.manage.timeouts.implicit_wait = 0 begin @aSOP_Headers=[] response_hash = Hash.new {|h,k| h[k] = Hash.new(&h.default_proc) } if get_Profiles_CustomProfile_CheckboxValue get_Profiles_StandardObjectPermissions_table.each_with_index do |row, index| if index == 0 row.find_elements(:xpath => "./td[2]/table/tbody/tr[2]/th").each do |header| @aSOP_Headers.push(header.text.strip! || header.text) end else # -- Left Column of Table $tempObjectName_Left=row.find_element(:xpath => "./th[1]").text row.find_elements(:xpath => "./td[1]/table/tbody/tr/td").each_with_index do |hv, idx| response_hash[$tempObjectName_Left][@aSOP_Headers[idx]]=hv.find_element(:xpath => "./img").attribute("alt") unless hv.find_elements(:xpath => ".//*").size == 0 end # -- Right Column of Table if row.find_element(:xpath => "./td[2]").attribute("class") != "labelCol last empty" $tempObjectName_Right=row.find_element(:xpath => "./th[2]").text row.find_elements(:xpath => "./td[2]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size != 0 response_hash[$tempObjectName_Right][@aSOP_Headers[idx]]=hv.find_element(:xpath => "./img").attribute("alt") unless hv.find_elements(:xpath => ".//*").size == 0 end end end end end end @driver.manage.timeouts.implicit_wait = @implicitWait return response_hash rescue puts $! puts $@ ensure @driver.manage.timeouts.implicit_wait = @implicitWait end end
get_Profiles_StandardObjectPermissions_table
> returns all the elements for the Profiles Standard Object Permissions table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 43 def get_Profiles_StandardObjectPermissions_table return @driver.find_elements(:xpath => "//h3[contains(.,'Standard Object Permissions')]/../following-sibling::div[1]/table/tbody/tr") end
> Returns a hash; Key = Tab Name, Value = Default On; Default Off; Tab Hidden¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 372 def get_Profiles_TabSettings begin @hConfig=Hash.new if !get_Profiles_TabSettings_table.nil? get_Profiles_TabSettings_table.each do |row| next if row.attribute("class") == "detailRow" @hConfig[row.find_element(:xpath => "./td[1]").text]=row.find_element(:xpath => "./td[2]").text @hConfig[row.find_element(:xpath => "./td[3]").text]=row.find_element(:xpath => "./td[4]").text unless row.find_element(:xpath => "./td[3]").attribute("class") == "labelCol last empty" end return @hConfig end rescue puts $! puts $@ end end
get_Profiles_TabSettings_table
> returns all the elements for the Profiles Tab Settings table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 59 def get_Profiles_TabSettings_table if !@driver.find_elements(:xpath => "//h3[contains(.,'Tab Settings')]").nil? @aStandardTable=@driver.find_elements(:xpath => "//h3[contains(.,'Tab Settings')]/../following-sibling::div[1]/table/tbody/tr") @aCustomTable=@driver.find_elements(:xpath => "//h3[contains(.,'Tab Settings')]/../following-sibling::div[2]/table/tbody/tr") @aStandardTable.push *@aCustomTable return @aStandardTable end end
get_Profiles_VisualforcePageAccess
> Returns an Array; [VfPageAccess1, VfPageAccess2]¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 715 def get_Profiles_VisualforcePageAccess @driver.manage.timeouts.implicit_wait = 0 begin aResponse=[] puts "Visualforce Page Access Row Count: #{get_Profiles_VisualforcePageAccess_table.size}" get_Profiles_VisualforcePageAccess_table.each do |row| aResponse.push(row.find_element(:xpath => "./th[1]/a").text) unless row.attribute('class')=='headerRow' end @driver.manage.timeouts.implicit_wait = @implicitWait return aResponse rescue puts $! puts $@ ensure @driver.manage.timeouts.implicit_wait = @implicitWait end end
get_Profiles_VisualforcePageAccess_table
> returns all the elements for the Profiles Visualforce Page Access table¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 90 def get_Profiles_VisualforcePageAccess_table return @driver.find_elements(:xpath => "//h3[contains(.,'Enabled Visualforce Page Access')]/../../../../../following-sibling::div[1]/table/tbody/tr") end
get_RenameTabsLabels_CustomTable
> returns all the elements for the Rename Tabs and Labels Custom Tabs Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 29 def get_RenameTabsLabels_CustomTable # return @driver.find_elements(:xpath => "//table[@class='list'][2]/tbody/tr") return @driver.find_elements(:xpath => "//form[@id='thisform']/div[3]/div[1]/div/div[2]/table[@class='list']/tbody/tr") # /html/body/div/div[2]/table/tbody/tr/td[2]/form/div[3]/div[1]/div/div[2]/table end
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 175 def get_RenameTabsLabels_Standard response=Hash.new # -- Step 1 of 2 case get_RenameTabsLabels_StandardTable_Step1[1].find_element(:xpath => "./td[2]").text when "English", "English (UK)" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2,3 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 4 response[row.find_element(:xpath => "./td[1]/label").text] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end when "Indonesian" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2,3 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "German" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub Table information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Romanian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub Table information aSubTables=['Nominative', 'Dative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Spanish", "Portuguese (Brazilian)", "Dutch", "Spanish (Mexican)", "Bulgarian", "Portuguese (European)" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "French" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 5 response[row.find_element(:xpath => "./td[1]/label").text] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end when "Italian" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 5 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end when "Japanese", "Korean", "Chinese (Traditional)", "Chinese (Simplified)", "Thai", "Vietnamese" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Swedish", "Danish", "Norwegian", "Hebrew", "Arabic" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text else response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Finnish" # - Get Tab, Language get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text end break if idx > 1 end # - Get Sub section information aSubTables=['Nominative', 'Genitive', 'Inessive', 'Elative', 'Illative', 'Adessive', 'Ablative', 'Allative', 'Essive', 'Translative', 'Partitive'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Russian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Prepositional'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Hungarian" # - Get Tab, Language get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text end break if idx > 1 end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Dative', 'Inessive', 'Elative', 'Illative', 'Ablative', 'Allative', 'Translative', 'Instrumental', 'Sublative', 'Superessive', 'Delative', 'Causal-Final', 'Essive-Formal', 'Terminative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end # - Get final Sub section information that has checkbox in the last row subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable('Distributive').each_with_index do |row, idx| if idx < 6 subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") else subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end response['Distributive']=subresponse when "Polish", "Czech", "Ukrainian", "Slovene" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Locative', 'Vocative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Turkish" # - Get Tab, Language get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text end break if idx > 1 end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Ablative', 'Locative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Greek" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Vocative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end when "Slovak", "Croatian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Locative'] aSubTables.each do |s| subresponse=Hash.new get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end response[s]=subresponse end end # -- Click Next to get to Step 2 click_Btn_RenameTabslabels_Next # -- Step 2 of 2 # --- Standard Field Labels Table # puts "Step2: Standard Field Labels: #{get_RenameTabsLabels_StandardTable_Step2_StandardField.length}" @driver.manage.timeouts.implicit_wait = 0 aStep2Headers=[] iStep2HeaderCount=0 iTableCount=1 hStep2RowResponse=Hash.new srowFieldLabel='' while iTableCount < 3 if iTableCount == 1 aTable=get_RenameTabsLabels_StandardTable_Step2_StandardField else aTable=get_RenameTabsLabels_StandardTable_Step2_OtherLabels end # puts "iTableCount: #{iTableCount}; Table Count: #{aTable.size}" aTable.each_with_index do |row, idx| hStep2SubRowResp=Hash.new # puts "Row: #{idx}" if idx == 0 iStep2HeaderCount = row.find_elements(:xpath => "./th").length row.find_elements(:xpath => "./th").each do |subrow| aStep2Headers.push(subrow.text) end else case iStep2HeaderCount when 2 # - Find countries that have only two Step 2 Header Columns srowFieldLabel=row.find_element(:xpath => "./th").text hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 when 3 # - Find countries that have only three Step 2 Header Columns srowFieldLabel=row.find_element(:xpath => "./th").text hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 when 4 # - Find countries that have only four Step 2 Header Columns srowFieldLabel=row.find_element(:xpath => "./th").text hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 if row.find_element(:xpath => "./td[3]").attribute("class") == " dataCell booleanColumn" # - get checkbox value hStep2SubRowResp[aStep2Headers[3]] = !row.find_element(:xpath => "./td[3]/input").attribute("checked").nil? else # - Get gender value hStep2SubRowResp[aStep2Headers[3]] = row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[3]//*").size == 0 end when 5 # - Find countries that have only five Step 2 Header Columns srowFieldLabel=row.find_element(:xpath => "./th").text hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 hStep2SubRowResp[aStep2Headers[3]]=row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[3]//*").size == 0 if row.find_element(:xpath => "./td[4]").attribute("class") == " dataCell booleanColumn" # - get checkbox value hStep2SubRowResp[aStep2Headers[4]] = !row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? else # - Get gender value hStep2SubRowResp[aStep2Headers[4]] = row.find_element(:xpath => "./td[4]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[4]//*").size == 0 end end hStep2RowResponse[srowFieldLabel]=hStep2SubRowResp end end if iTableCount == 1 response['Standard Field Labels'] = hStep2RowResponse else response['Other Labels'] = hStep2RowResponse end iTableCount +=1 end # -- Step 2 Other Labels # puts "Step2: Other Labels Row Count: #{get_RenameTabsLabels_StandardTable_Step2_OtherLabels.size}" @driver.manage.timeouts.implicit_wait = @implicitWait return response end
get_RenameTabsLabels_StandardTable
> returns all the elements for the Rename Tabs and Labels Standard Tabs Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 20 def get_RenameTabsLabels_StandardTable # return @driver.find_elements(:xpath => "//table[@class='list'][1]/tbody/tr") return @driver.find_elements(:xpath => "//form[@id='thisform']/div[2]/div[1]/div/div[2]/table[@class='list']/tbody/tr") end
get_RenameTabsLabels_StandardTable_Step1
> returns all the elements for the Rename Tabs and Labels Standard Tabs Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 48 def get_RenameTabsLabels_StandardTable_Step1 return @driver.find_elements(:xpath => "//table[@class='detailList']/tbody/tr") end
get_RenameTabsLabels_StandardTable_Step1_Subtable
> sSubTableName¶ ↑
> returns all the elements for the Raname Tabs and Labels Standard Sub Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 40 def get_RenameTabsLabels_StandardTable_Step1_Subtable(sSubTableName) return @driver.find_elements(:xpath => "//h3[contains(.,'#{sSubTableName}')]/../following-sibling::div[1]/table/tbody/tr") end
get_RenameTabsLabels_StandardTable_Step2_OtherLabels
> returns all the elements for the Rename Tabs and Labels Other Labels Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 66 def get_RenameTabsLabels_StandardTable_Step2_OtherLabels # return @driver.find_elements(:xpath => "//table[@class='list']/tbody/tr") return @driver.find_elements(:xpath => "//div[@class='listRelatedObject setupBlock'][2]/div/div[2]/table/tbody/tr") # /html/body/div/div[2]/table/tbody/tr/td[2]/form/div/div[2]/div[4]/div[4]/div/div[2]/table/tbody/tr[1] end
get_RenameTabsLabels_StandardTable_Step2_StandardField
> returns all the elements for the Rename Tabs and Labels Standard Tabs Table¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 56 def get_RenameTabsLabels_StandardTable_Step2_StandardField # return @driver.find_elements(:xpath => "//table[@class='list']/tbody/tr") return @driver.find_elements(:xpath => "//div[@class='listRelatedObject setupBlock'][1]/div/div[2]/table/tbody/tr") # return @driver.find_elements(:xpath => "/html/body/div/div[2]/table/tbody/tr/td[2]/form/div/div[2]/div[4]/div[2]/div/div[2]/table/tbody/tr") end
get_SharingSettingAccessTable_Edit
> returns all the elements for the Sharing Settings Access Table¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 27 def get_SharingSettingAccessTable_Edit return @driver.find_elements(:xpath => "//table[@class='detailList']/tbody/tr") end
> sObjName = string value of the sharing setting object to return¶ ↑
> Return = Hash of column values for indicated object name¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 113 def get_SharingSettingsAccess(sObjName) $accessHeaders=[] response=Hash.new get_SharingSettingAccessTable.each_with_index do |row, index| if index == 0 # - Get headers row.find_elements(:xpath => "./th").each do |h| $accessHeaders.push(h.text) end else # - Get Values for matching Object Name if row.find_element(:xpath => "./th").text == sObjName response[$accessHeaders[1]]=row.find_element(:xpath => "./td[1]").text response[$accessHeaders[2]]=row.find_element(:xpath => "./td[2]").text response[$accessHeaders[3]]=row.find_element(:xpath => "./td/img").attribute("title") unless row.find_elements(:xpath => "./td[3]//*").size == 0 break end end end return response end
get_Translate_CustomReportTypeEntity
> returns all the elements for the Translate Custom Report Type Entity dropdown¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 30 def get_Translate_CustomReportTypeEntity return @driver.find_elements(:xpath => "//div[@id='twb:theForm:filterBlock:filterPageBlock']/div/table/tbody/tr[3]/td/span/select/option") end
get_Translate_CustomReportType_FieldLabel_rows
> returns all the elements for the Translate Custom Report Type - Field Label rows¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 48 def get_Translate_CustomReportType_FieldLabel_rows return @driver.find_elements(:xpath => "//div[@id='gridID']/div[1]/div[2]/div[1]/div[1]/div[2]/div/div") end
get_Translation_CustomReportType_Description
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 249 def get_Translation_CustomReportType_Description(sCustomReportTypeName) response=Hash.new blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sCustomReportTypeName response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return response end
get_Translation_CustomReportType_FieldLabel
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 183 def get_Translation_CustomReportType_FieldLabel(sCustomReportTypeName) response=Hash.new blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sCustomReportTypeName response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return response end
get_Translation_CustomReportType_LayoutSection
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 319 def get_Translation_CustomReportType_LayoutSection(sMasterLayoutSection, sCustomReportTypeName) response=Hash.new blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sMasterLayoutSection and get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[3]/div").text == sCustomReportTypeName response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return response end
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 385 def get_Translation_RecordType(sMasterRecordTypeLabel) response=Hash.new blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sMasterRecordTypeLabel response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return response end
get_btn_Translate_CustomReportType_FieldLabel_Next
> returns the element for the Translate Custom Report Type - Field Label Next button¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 57 def get_btn_Translate_CustomReportType_FieldLabel_Next return @driver.find_element(:xpath => "//table[@id='nextTextBtn']/tbody/tr[2]/td[2]/em/button") end
get_elements_HomePageLayouts_Profiles_table
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 37 def get_elements_HomePageLayouts_Profiles_table return @driver.find_elements(:xpath => "//table[@class='detailList']/tbody/tr") end
# File lib/sfdc_se/general/general.rb, line 9 def raw_login(username, password, host) binding = RForce::Binding.new %{https://#{host}/services/Soap/u/36.0} resp = binding.login( username, password ) server_url = resp[:loginResponse][:result][:serverUrl] uri = URI(server_url) { :instance_url => %{#{uri.scheme}://#{uri.host}}, :oauth_token => resp[:loginResponse][:result][:sessionId] } end
reset_PasswordSecurityQuestion
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 10 def reset_PasswordSecurityQuestion(sCurentPassword, sNewPassword, sAnswer) blnEdit=false if @driver.find_elements(:id => 'currentpassword').size > 0 set_CurrentPasswordField(sCurentPassword) set_NewPasswordField(sNewPassword) set_ConfirmPasswordField(sNewPassword) set_AnswerField(sAnswer) click_Btn_ChangePassword blnEdit=true end return blnEdit end
# File lib/sfdc_se/general/general.rb, line 22 def restforce_client(options) Restforce.new( raw_login(options[:username], options[:password], (options[:sandbox] ? 'test.salesforce.com' : 'login.salesforce.com') ).merge(:api_version => '36.0') ) end
take screenshot
# File lib/sfdc_se.rb, line 95 def save_screenshot(filename) @driver.save_screenshot(filename) end
> sProfileName = String value of the profile name to select¶ ↑
> Return = true or false¶ ↑
> true = Profile successfully selected¶ ↑
> false = Profile selection had an error¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 221 def select_Profile(sProfileName) blnValue=false begin get_elements_Profiles_table.each do |row| tableProfile=row.find_element(:xpath => "./td[4]").text if tableProfile==sProfileName row.find_element(:xpath => "./td[4]/div/a").click blnValue=true return blnValue end end rescue puts $! puts $@ blnValue = false end return blnValue end
setExplicitWait
> used to set the explicit waits in secs¶ ↑
> secs = timeout in secs¶ ↑
# File lib/sfdc_se.rb, line 57 def setExplicitWait(secs) @explicitWait=secs || 30 if !@explicitWait.is_a?(Numeric) @explicitWait.to_i end @wait=Selenium::WebDriver::Wait.new(:timeout => @explicitWait) return @wait end
set_AnswerField
(sAnswer)
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 48 def set_AnswerField(sAnswer) @driver.find_element(:id => 'answer').send_keys(sAnswer) end
set_ConfirmPasswordField
(sPWD)
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 41 def set_ConfirmPasswordField(sPWD) @driver.find_element(:id => 'confirmpassword').send_keys(sPWD) end
set_CurrentPasswordField
(sPWD)
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 27 def set_CurrentPasswordField(sPWD) @driver.find_element(:id => 'currentpassword').send_keys(sPWD) end
> sObjName = string value of the object to set¶ ↑
> hObjValues = Email Alert Field Hash {Field, Value}¶ ↑
> addnew = Boolean, defaults to false unless true is passed¶ ↑
- Set to true to create a new Email Alert (rather then adjusting the configuration of an existing one)
> return = true/false¶ ↑
- True = Email Alert Configuration was updated - False = Email Alert Configration was NOT updated
# File lib/sfdc_se/pages/page_emailalerts.rb, line 187 def set_EmailAlert_Configuration(sObjName, hObjValues, addnew=false) addnew=false unless addnew==true blnUpdateReturn=false r=0 while r < get_EmailAlertsEditTable.length case r when 0,1 # 0 = Description, 1 = Uniique Name if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/input").attribute("value")) get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/input").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnUpdateReturn=true end when 2 # - 2 = Object - Not configurable if addnew get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")] option.click unless option.selected? break end end end when 4, 7, 8 # - 4,7 = Blank Row, 8 = Text, no configurable item # - Do nothing, row not required when 3 # - 3 = Email Template if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/span/input").attribute("value")) get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/span/input").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnUpdateReturn=true end when 5 # - 5 = Recipient Type - Not a configurable item, used for Selected Recipients section $precedRow=get_EmailAlertsEditTable[r] when 6 # - 6 = Recipents #-Gets current Selected Recipents list $aSelected=[] get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |sr| $aSelected.push(sr.text) end #-Returns the Recipents that need to be added to the Selected List aAddRecipents=hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")]-$aSelected if aAddRecipents.size > 0 # - Add Required Recipents aAddRecipents.each do |adduser| searchItem="" searchName="" case when adduser.include?(": ") searchItem=adduser[0..(adduser.index(": ")-1)] searchItem="Public Groups" if adduser[0..(adduser.index(": ")-1)] == "Group" searchName=adduser[(adduser.index(": ")+2)..-1] when adduser == "Account Owner" searchItem=adduser searchName=adduser when adduser.include?("Creator") searchItem="Creator" searchName=adduser when adduser == "Lead or Contact Owner" searchItem="Related Lead or Contact Owner" searchName=adduser when adduser.include?("Owner") searchItem="Owner" searchName=adduser end if !searchItem.nil? $precedRow.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == searchItem #-Recipient Type Search Option selection option.click unless option.selected? #-Recipient 'For' textbox, to narrow down 'Available Recipients' list $precedRow.find_element(:xpath => "./td[2]/div/input[@type='text' and @id='searchValue_userFilter']").clear() $precedRow.find_element(:xpath => "./td[2]/div/input[@type='text' and @id='searchValue_userFilter']").send_keys(searchName) $precedRow.find_element(:xpath => "./td[2]/div/input[@class='btn' and @title='Find']").click #-Select and move to right, Recipient (from Avialable list) get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[1]/select/option").each do |option| if option.text == adduser option.click end end get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/table/tbody/tr/td[2]/div[2]/a").click end end end end blnUpdateReturn=true end #-Returns the Recipents that need to be removed from the current Selected List aRemoveRecipents=$aSelected-hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")] aRemoveRecipents=aRemoveRecipents-["--None--"] if aRemoveRecipents.size > 0 aRemoveRecipents.each do |removeRecipient| get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/table/tbody/tr/td[3]/select/option").each do |option| if option.text == removeRecipient option.click unless option.selected? end end get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/table/tbody/tr/td[2]/div[3]/a").click end puts "Recipents to Remove: #{aRemoveRecipents}" blnUpdateReturn=true end when 9 # - 9 = Additional Emails if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/textarea").text) get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/textarea").send_keys(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnUpdateReturn=true end when 10 # - 10 = From Email Address if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label")] == get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text) get_EmailAlertsEditTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[1]/label")] option.click unless option.selected? blnUpdateReturn=true end end end when 11 # - 11 = Checkbox; Make this address the default From email address for this object's email alerts checkboxStatus=get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? "false" : "true" if !(hObjValues[sObjName][get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/label").text] == checkboxStatus) get_EmailAlertsEditTable[r].find_element(:xpath => "./td[2]/input").click blnUpdateReturn=true end end r+=1 end return blnUpdateReturn end
> sViewName = string value of the Sharing Setting option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_emailalerts.rb, line 89 def set_EmailAlerts_View(sViewName) blnViewSet=false begin get_EmailAlertsViewOptions.each do |option| if option.text == sViewName option.click unless option.selected? blnViewSet=true return blnViewSet end end rescue puts $! puts $@ end return blnViewSet end
set_FieldUpdates_Configuration
> sObjName = string value of the object to set¶ ↑
> hObjValues = Values to set, Hash {Field, Value}¶ ↑
> addnew = Boolean, defaults to false unless true is passed¶ ↑
- Set to true to create a new Email Alert (rather then adjusting the configuration of an existing one)
> return = true/false¶ ↑
- True = Configuration was updated - False = Configration was NOT updated
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 265 def set_FieldUpdates_Configuration(sObjName, hObjValues, addnew=false) addnew=false unless addnew==true blnUpdateReturn=false r=0 @driver.manage.timeouts.implicit_wait = 0 # - Get 'Identification' section of the Field Update page while r < get_FieldUpdatesEdit_IdentificationTable.length # get_FieldUpdatesEdit_IdentificationTable.each_with_index do |row, idx| case r when 0,1 # - 0=Name, 1=Unique Name 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")) get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/div/input").clear() 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", "")]) puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 2 # - 2=Description 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) get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/textarea").clear() 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", "")]) puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/textarea").text when 3,4 # - 3=Object, 4=Field to Update # - Object if addnew if get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[1]//*").size == 0 # - Row has multiple dropdown selections aFieldToUpdate=hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]").text.gsub("*\n", "")].split(": ") aFieldToUpdate.each_with_index do |aFieldSelection, idx| if idx == 0 aDropdownLists=get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select[#{idx+1}]/option") else aDropdownLists=get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select[#{idx+1}]/optgroup/option") end aDropdownLists.each do |option| if option.text == aFieldSelection option.click unless option.selected? sleep(5) puts "Updated Field: #{aFieldSelection}" blnUpdateReturn=true break end end end else # - Row has single dropdown seletion get_FieldUpdatesEdit_IdentificationTable[r].find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click unless option.selected? sleep(5) puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true break end end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text when 5 # - 5=Field Data Type $sFldDataType=get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]").text # response[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]").text when 6 # - 6=Re-evaluate Workflow Rules after Field Change; Checkbox checkboxStatus=get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/input").attribute("checked").nil? ? "false" : "true" if !(hObjValues[sObjName][get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == checkboxStatus) get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[2]/input").click puts "Updated Field: #{get_FieldUpdatesEdit_IdentificationTable[r].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # 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") # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/input").attribute("value") end r+=1 end # - Determine the 'Specify New Field Value' section and set configuration case $sFldDataType when "Picklist" # - Picklist Options added to hash get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx| case idx when 0,1 if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s) radiobtns.find_element(:xpath => "./input").click puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[radiobtns.find_element(:xpath => "./label").text] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil? ).to_s # if radiobtns.find_element(:xpath => "./input").selected? # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text # end when 2 if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][0] == (!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s) radiobtns.find_element(:xpath => "./div/input").click radiobtns.find_elements(:xpath => "./div/span/select/option").each do |option| if option.text == hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1] puts "Updated Dropdown Value To: #{option.text}" unless option.selected? option.click unless option.selected? end end puts "Updated Field: #{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # 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] # if radiobtns.find_element(:xpath => "./div/input").selected? # 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}" # end end end end when "Record Type" # - Record Type dropdrown added to hash 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) get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hObjValues[sObjName][get_FieldUpdatesEdit_SpecifyNewFieldValueTable[1].find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] puts "Updated Dropdown Value To: #{option.text}" unless option.selected? option.click unless option.selected? blnUpdateReturn=true end end end # 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 when "Date/Time", "Text", "Text Area", "Date", "Currency", "Phone", "Number", "Long Text Area", "Email", "Fax" # - Date Options added to hash; Text Options added to hash get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each_with_index do |radiobtns, idx| case idx when 0 if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s) radiobtns.find_element(:xpath => "./input").click puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s # if radiobtns.find_element(:xpath => "./input").selected? # response[row.find_element(:xpath => "./td[2]/h5").text]=radiobtns.find_element(:xpath => "./label").text # end when 1 #- Validate Radio Button and then Dropdown Value if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][0] == (!radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil?).to_s) radiobtns.find_element(:xpath => "./div/input").click puts "Upated Field: #{radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")}" blnUpdateReturn=true end if !radiobtns.find_element(:xpath => "./div/input").attribute("checked").nil? puts "Formula Value - JSON: #{hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1]}" 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) radiobtns.find_element(:xpath => "./div/div/div[2]/table/tbody/tr/td/div/textarea").clear() 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]) puts "Updated Text/Formula To : #{hObjValues[sObjName][radiobtns.find_element(:xpath => "./div/label").text.gsub("*\n", "")][1]}" blnUpdateReturn=true end end # 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] # if radiobtns.find_element(:xpath => "./div/input").selected? # 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}" # end end end end when "Checkbox" get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each do |row| row.find_elements(:xpath => "./td[2]/ul/li").each do |radiobtns| if !(hObjValues[sObjName][radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] == (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s) radiobtns.find_element(:xpath => "./input").attribute("checked").click puts "Updated Field: #{radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[radiobtns.find_element(:xpath => "./label").text.gsub("*\n", "")] = (!radiobtns.find_element(:xpath => "./input").attribute("checked").nil?).to_s # 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") end end when "Lookup" get_FieldUpdatesEdit_SpecifyNewFieldValueTable.each_with_index do |row, idx| case idx when 0 # - Do nothing, blank row when 1 # - Text Box (Lookup) Field # -######################################## if !(hObjValues[sObjName][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] == row.find_element(:xpath => "./td[2]/div/span/input").attribute("value")) row.find_element(:xpath => "./td[2]/div/span/input").clear() row.find_element(:xpath => "./td[2]/div/span/input").send_keys(hObjValues[sObjName][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) puts "Updated Field: #{row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/span/input").attribute("value") when 2 # - Checkbox 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) row.find_element(:xpath => "./td[2]/input").click puts "Update Field: #{row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}" blnUpdateReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = (!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s end end end # return response @driver.manage.timeouts.implicit_wait = @implicitWait return blnUpdateReturn end
> sViewName = string value of the Sharing Setting option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_fieldupdates.rb, line 99 def set_FieldUpdates_View(sViewName) blnViewSet=false begin get_EmailAlertsViewOptions.each do |option| if option.text == sViewName option.click unless option.selected? blnViewSet=true # return blnViewSet break end end # - TODO: Add logic to get all rows on one page currentURL=@driver.current_url puts "Current URL: #{currentURL}" currentURL=@driver.current_url[0..(@drivercurrent_url.index("rowsperpage=")+12)] & "1000" if currentURL.include?("rowsperpage=") puts "Updated URL: #{currentURL}" rescue puts $! puts $@ end return blnViewSet end
set_HomePageLayout_Profile_Assignments
> hProfileAssignments = Hash of the profiles and assignments¶ ↑
> key = Profile¶ ↑
> value = assignment¶ ↑
> Return = true or false¶ ↑
> true = setting of all assignments were successful¶ ↑
> false = setting had an error, or no vales were changed¶ ↑
# File lib/sfdc_se/pages/page_homepagelayouts.rb, line 62 def set_HomePageLayout_Profile_Assignments(hProfileAssignments) blnChangedValue=false begin get_elements_HomePageLayouts_Profiles_table.each do |row| strProfile=row.find_element(:xpath => "./td[1]").text if strProfile[0] == "*" strProfile=strProfile[1..-1] end if hProfileAssignments.has_key? (strProfile) # check if current value is already set to assignment, if not set options=row.find_elements(:xpath => "./td[2]/div/select/option") options.each do |option| if option.selected? $strCurrentlySelected = option.text end end if hProfileAssignments[strProfile] != $strCurrentlySelected options.each do |option| if option.text == hProfileAssignments[strProfile] option.click blnChangedValue=true end end end end end rescue puts $! puts $@ blnChangedValue = false end return blnChangedValue end
set_LocaleSidKey
(blnSandbox, sUserName, sPassword, LocaleSidKey)
> Returns true or false¶ ↑
# File lib/sfdc_se/general/general.rb, line 51 def set_LocaleSidKey(blnSandbox, sUserName, sPassword, sLocaleSidKey) ENV['http_proxy']='http://webproxy.merck.com:8080' ENV['https_proxy']='https://webproxy.merck.com:8080' blnRep=false client=restforce_client({:sandbox => blnSandbox, :username => sUserName, :password => sPassword}) resp_SOQL=client.query("SELECT Id,LocaleSidKey FROM User WHERE Username = '#{sUserName}'") if resp_SOQL.size > 0 resp_SOQL.each do |r| if r['LocaleSidKey'] != sLocaleSidKey client.update('User', Id: r['Id'], LocaleSidKey: sLocaleSidKey) ? blnRep=true : blnRep=false elsif r['LocaleSidKey'] == sLocaleSidKey blnRep=true end end end ENV.delete('HTTP_PROXY') ENV.delete('HTTPS_PROXY') return blnRep end
set_NewPasswordField
(sPWD)
# File lib/sfdc_se/pages/page_passwordsecuritysetting.rb, line 34 def set_NewPasswordField(sPWD) @driver.find_element(:id => 'newpassword').send_keys(sPWD) end
> sViewName = string value of the view name to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 197 def set_Profile_View(sViewName) blnViewSet=false begin get_ProfileViewOptions.each do |option| if option.text == sViewName option.click unless option.selected? blnViewSet=true return blnViewSet end end rescue puts $! puts $@ end return blnViewSet end
set_Profiles_AdministrativePermissions
> hValues = an input Hash of the values to set per profile¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 266 def set_Profiles_AdministrativePermissions(hValues) @driver.manage.timeouts.implicit_wait = 0 blnReturn=false get_Profiles_AdministrativePermissions_table.each do |i| # - Left hand column if i.find_elements(:xpath => "./td[2]/img").size == 0 sOrgSetting = i.find_element(:xpath => "./td[2]/input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting==hValues[i.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]) i.find_element(:xpath => "./td[2]/input").click blnReturn=true end end # - Right hand column if i.find_elements(:xpath => "./td[4]/img").size == 0 and i.find_element(:xpath => "./td[3]").attribute("class") != "labelCol last empty" sOrgSetting = i.find_element(:xpath => "./td[4]/input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting==hValues[i.find_element(:xpath => "./td[3]").text.gsub("*\n", "")]) i.find_element(:xpath => "./td[4]/input").click blnReturn=true end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn end
> hValues = Hash of the values to be set for the indicated Profile/Section¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 684 def set_Profiles_ApexClassAccess(hValues) @driver.manage.timeouts.implicit_wait = 0 blnReturn=false begin hValues.each do |value| options=get_Profiles_ApexClassAccess_AvailableSelect options.each do |option_s| if option_s.text == value option_s.click click_btn_Profiles_ApexClassAccess_Add blnReturn=true break end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn rescue puts $! puts $@ ensure @driver.manage.timeouts.implicit_wait = @implicitWait end end
set_Profiles_CustomObjectPermissions
> hValues = Hash of the values to be set for the indicated Profile/Section¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 596 def set_Profiles_CustomObjectPermissions(hValues) @driver.manage.timeouts.implicit_wait = 0 @aCOP_Headers=[] blnReturn=false get_Profiles_CustomObjectPermissions_table.each_with_index do |row, index| if index == 0 row.find_elements(:xpath => "./td[2]/table/tbody/tr[2]/th").each do |header| @aCOP_Headers.push(header.text) end else # -- Left Column of Table row.find_elements(:xpath => "./td[1]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size > 0 sOrgSetting = hv.find_element(:xpath => "./input").selected? ? "Checked" : "Not Checked" print "Row/Index: #{index}; Label: #{row.find_element(:xpath => "./th[1]").text}; Hash Include True/False: #{hValues.include?(row.find_element(:xpath => "./th[1]").text)}\r" if hValues.include?(row.find_element(:xpath => "./th[1]").text) if !(sOrgSetting == hValues[row.find_element(:xpath => "./th[1]").text][@aCOP_Headers[idx]]) hv.find_element(:xpath => "./input").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end blnReturn=true end end end end # -- Right Column of Table if row.find_element(:xpath => "./td[2]").attribute("class") != "labelCol last empty" row.find_elements(:xpath => "./td[2]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size > 0 sOrgSetting = hv.find_element(:xpath => "./input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting == hValues[row.find_element(:xpath => "./th[2]").text][@aCOP_Headers[idx]]) hv.find_element(:xpath => "./input").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end blnReturn=true end end end end end end @driver.manage.timeouts.implicit_wait = @implicitWait print "\n" return blnReturn end
set_Profiles_GeneralUserPermissions
> Returns a hash; Key = Permission Name, Value = Checked/Unchecked¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 322 def set_Profiles_GeneralUserPermissions(hValues) @driver.manage.timeouts.implicit_wait = 0 blnReturn=false get_Profiles_GeneralUserPermissions_table.each do |row| # - Left Hand Column if row.find_elements(:xpath => "./td[2]/img").size == 0 sOrgSetting = row.find_element(:xpath => "./td[2]/input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting==hValues[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/input").click blnReturn=true end end # - Right Hand Column if row.find_elements(:xpath => "./td[4]/img").size == 0 and row.find_element(:xpath => "./td[3]").attribute("class") != "labelCol last empty" sOrgSetting = row.find_element(:xpath => "./td[4]/input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting==hValues[row.find_element(:xpath => "./td[3]").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[4]/input").click blnReturn=true end end end # begin # @aConfig=Hash.new # #-TODO: Check if profile is CustomProfile (if not return blank hash) # if get_Profiles_CustomProfile_CheckboxValue # get_Profiles_GeneralUserPermissions_table.each do |row| # @aConfig[row.find_element(:xpath => "./td[1]").text]=row.find_element(:xpath => "./td[2]/img").attribute("alt") # @aConfig[row.find_element(:xpath => "./td[3]").text]=row.find_element(:xpath => "./td[4]/img").attribute("alt") unless row.find_element(:xpath => "./td[3]").attribute("class") == "labelCol last empty" # end # end # return @aConfig # rescue # puts $! # puts $@ # end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn end
set_Profiles_StandardObjectPermissions
> hValues = Hash of the values to be set for the indicated Profile/Section¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 484 def set_Profiles_StandardObjectPermissions(hValues) @driver.manage.timeouts.implicit_wait = 0 blnReturn=false @aSOP_Headers=[] get_Profiles_StandardObjectPermissions_table.each_with_index do |row, index| next if index < 2 if index == 2 row.find_elements(:xpath => "./td[2]/table/tbody/tr[2]/th").each do |header| @aSOP_Headers.push(header.text) end else # -- Left Column of Table row.find_elements(:xpath => "./td[1]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size > 0 sOrgSetting = hv.find_element(:xpath => "./input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting == hValues[row.find_element(:xpath => "./th[1]").text][@aSOP_Headers[idx]]) hv.find_element(:xpath => "./input").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end blnReturn=true end end end # -- Right Column of Table if row.find_element(:xpath => "./td[2]").attribute("class") != "labelCol last empty" row.find_elements(:xpath => "./td[2]/table/tbody/tr/td").each_with_index do |hv, idx| if hv.find_elements(:xpath => ".//*").size > 0 sOrgSetting = hv.find_element(:xpath => "./input").selected? ? "Checked" : "Not Checked" if !(sOrgSetting == hValues[row.find_element(:xpath => "./th[2]").text][@aSOP_Headers[idx]]) hv.find_element(:xpath => "./input").click sMsg="" a=@driver.switch_to.alert rescue "Exception happened" if !(a == "Exception happened") sMsg= "Accepting Alert: #{a.text}" a.accept end blnReturn=true end end end end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn end
> hProfileValues = Hash of the values to be set for the indicated Profile/Section¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 395 def set_Profiles_TabSettings(hProfileValues) blnReturn=false begin if !get_Profiles_TabSettings_table.nil? get_Profiles_TabSettings_table.each do |row| next if row.attribute("class") == "detailRow" if row.find_elements(:xpath => "./td[2]//*").size > 0 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hProfileValues[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hProfileValues[row.find_element(:xpath => "./td[1]").text.gsub("*\n", "")] option.click blnReturn=true end end end end if (row.find_element(:xpath => "./td[3]").attribute("class") != "labelCol last empty") and (row.find_elements(:xpath => "./td[4]//*").size > 0) if !(row.find_element(:xpath => "./td[4]/div/select/option[@selected='selected']").text == hProfileValues[row.find_element(:xpath => "./td[3]").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[4]/div/select/option").each do |option| if option.text == hProfileValues[row.find_element(:xpath => "./td[3]").text.gsub("*\n", "")] option.click blnReturn=true end end end end end return blnReturn end rescue puts $! puts $@ end end
set_Profiles_VisualforcePageAccess
> hValues = Hash of the values to be set for the indicated Profile/Section¶ ↑
> Returns true/false¶ ↑
# File lib/sfdc_se/pages/page_profiles.rb, line 740 def set_Profiles_VisualforcePageAccess(hValues) @driver.manage.timeouts.implicit_wait = 0 blnReturn=false begin # -- Remove already 'enabled' VF Pages from hValues hValues.each do |value| options=get_Profile_VisualforcePageAccess_EnabledSelect options.each do |option_es| if option_es.text == value hValues=hValues - [value] break end end end puts "hValue Count after looking at enabled list: #{hValues.size}" hValues.each do |value| options=get_Profiles_ApexClassAccess_AvailableSelect options.each do |option_s| if option_s.text == value option_s.click click_btn_Profiles_ApexClassAccess_Add blnReturn=true break end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn rescue puts $! puts $@ ensure @driver.manage.timeouts.implicit_wait = @implicitWait end end
> sLanguage = string value of the Language option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 80 def set_RenameTabsLabels_Language(sLanguage) blnReturn=false begin get_RenameTabsLabels_Language.each do |option| if option.text == sLanguage option.click unless option.selected? blnReturn=true sleep(3) break end end rescue puts $! puts $@ end return blnReturn end
> Return = Hash {Key= Field Name/Type, Value=Field Value}¶ ↑
# File lib/sfdc_se/pages/page_renametabslabels.rb, line 542 def set_RenameTabsLabels_Standard(hValueSet) blnReturn=false # -- Step 1 of 2 case get_RenameTabsLabels_StandardTable_Step1[1].find_element(:xpath => "./td[2]").text when "English", "English (UK)" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2,3 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # puts "Value for #{row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")}: #{hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]}" # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 4 if !((!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s == hValueSet[row.find_element(:xpath => "./td[1]/label").text].to_s) row.find_element(:xpath => "./td[2]/input").click blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end when "Indonesian" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2,3 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "German" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true sleep(3) break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub Table information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Romanian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true sleep(3) break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub Table information aSubTables=['Nominative', 'Dative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Spanish", "Portuguese (Brazilian)", "Dutch", "Spanish (Mexican)", "Bulgarian", "Portuguese (European)" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").eah do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "French" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 5 if !((!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s == hValueSet[row.find_element(:xpath => "./td[1]/label").text].to_s) row.find_element(:xpath => "./td[2]/input").click blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end when "Italian" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option]").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]=row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text when 3,4 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") when 5 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end when "Japanese", "Korean", "Chinese (Traditional)", "Chinese (Simplified)", "Thai", "Vietnamese" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Swedish", "Danish", "Norwegian", "Hebrew", "Arabic" get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text else if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Finnish" # - Get Tab, Language # get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| # case idx # when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text # end # break if idx > 1 # end # - Get Sub section information aSubTables=['Nominative', 'Genitive', 'Inessive', 'Elative', 'Illative', 'Adessive', 'Ablative', 'Allative', 'Essive', 'Translative', 'Partitive'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Russian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Prepositional'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Hungarian" # - Get Tab, Language # get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| # case idx # when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text # end # break if idx > 1 # end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Dative', 'Inessive', 'Elative', 'Illative', 'Ablative', 'Allative', 'Translative', 'Instrumental', 'Sublative', 'Superessive', 'Delative', 'Causal-Final', 'Essive-Formal', 'Terminative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end # - Get final Sub section information that has checkbox in the last row get_RenameTabsLabels_StandardTable_Step1_Subtable('Distributive').each_with_index do |row, idx| if idx < 6 if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet['Distributive'][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet['Distributive'][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") else if !((!row.find_element(:xpath => "./td[2]/input").attribute("checked").nil?).to_s == hValueSet['Distributive'][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")].to_s) row.find_element(:xpath => "./td[2]/input").click blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = !row.find_element(:xpath => "./td[2]/input").attribute("checked").nil? end end when "Polish", "Czech", "Ukrainian", "Slovene" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Locative', 'Vocative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Turkish" # - Get Tab, Language # get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| # case idx # when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text # end # break if idx > 1 # end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Ablative', 'Locative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Greek" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Vocative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end when "Slovak", "Croatian" # - Get Tab, Language, Gender get_RenameTabsLabels_StandardTable_Step1.each_with_index do |row, idx| case idx when 0,1 # response[row.find_element(:xpath => "./td[1]").text] = row.find_element(:xpath => "./td[2]").text when 2 if !(row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_elements(:xpath => "./td[2]/div/select/option").each do |option| if option.text == hValueSet[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] option.click blnReturn=true break end end end # response[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/select/option[@selected='selected']").text end end # - Get Sub section information aSubTables=['Nominative', 'Accusative', 'Genitive', 'Dative', 'Instrumental', 'Locative'] aSubTables.each do |s| get_RenameTabsLabels_StandardTable_Step1_Subtable(s).each do |row| if !(row.find_element(:xpath => "./td[2]/div/input").attribute("value") == hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) row.find_element(:xpath => "./td[2]/div/input").clear() row.find_element(:xpath => "./td[2]/div/input").send_keys(hValueSet[s][row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")]) blnReturn=true end # subresponse[row.find_element(:xpath => "./td[1]/label").text.gsub("*\n", "")] = row.find_element(:xpath => "./td[2]/div/input").attribute("value") end end end # -- Click Next to get to Step 2 click_Btn_RenameTabslabels_Next # -- Step 2 of 2 # --- Standard Field Labels Table @driver.manage.timeouts.implicit_wait = 0 aStep2Headers=[] iStep2HeaderCount=0 iTableCount=1 srowFieldLabel='' sTableType='' while iTableCount < 3 if iTableCount == 1 aTable=get_RenameTabsLabels_StandardTable_Step2_StandardField sTableType='Standard Field Labels' else aTable=get_RenameTabsLabels_StandardTable_Step2_OtherLabels sTableType='Other Labels' end aTable.each_with_index do |row, idx| if idx == 0 iStep2HeaderCount = row.find_elements(:xpath => "./th").length row.find_elements(:xpath => "./th").each do |subrow| aStep2Headers.push(subrow.text) end else case iStep2HeaderCount when 2 # - Find countries that have only two Step 2 Header Columns if row.find_elements(:xpath => "./td[1]//*").size > 0 if !(row.find_element(:xpath => "./td[1]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) row.find_element(:xpath => "./td[1]/input").clear() row.find_element(:xpath => "./td[1]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) blnReturn=true end end # srowFieldLabel=row.find_element(:xpath => "./th").text # hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 when 3 # - Find countries that have only three Step 3 Header Columns if row.find_elements(:xpath => "./td[1]//*").size > 0 if !(row.find_element(:xpath => "./td[1]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) row.find_element(:xpath => "./td[1]/input").clear() row.find_element(:xpath => "./td[1]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) blnReturn=true end end if row.find_elements(:xpath => "./td[2]//*").size > 0 if !(row.find_element(:xpath => "./td[2]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) row.find_element(:xpath => "./td[2]/input").clear() row.find_element(:xpath => "./td[2]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) end end # srowFieldLabel=row.find_element(:xpath => "./th").text # hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 # hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 when 4 # - Find countries that have only four Step 4 Header Columns if row.find_elements(:xpath => "./td[1]//*").size > 0 if !(row.find_element(:xpath => "./td[1]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) row.find_element(:xpath => "./td[1]/input").clear() row.find_element(:xpath => "./td[1]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) blnReturn=true end end if row.find_elements(:xpath => "./td[2]//*").size > 0 if !(row.find_element(:xpath => "./td[2]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) row.find_element(:xpath => "./td[2]/input").clear() row.find_element(:xpath => "./td[2]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) blnReturn=true end end if row.find_element(:xpath => "./td[3]").attribute("class") == " dataCell booleanColumn" # - get checkbox value if !((!row.find_element(:xpath => "./td[3]/input").attribute("checked").nil?).to_s == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[3]].to_s) row.find_element(:xpath => "./td[3]/input").click blnReturn=true end # hStep2SubRowResp[aStep2Headers[3]] = !row.find_element(:xpath => "./td[3]/input").attribute("checked").nil? else # - Get gender value if row.find_elements(:xpath => "./td[3]//*").size > 0 if !(row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[3]]) row.find_elements(:xpath => "./td[3]/select/option").each do |option| if option.text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[3]] option.click blnReturn=true break end end end end # hStep2SubRowResp[aStep2Headers[3]] = row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[3]//*").size == 0 end # srowFieldLabel=row.find_element(:xpath => "./th").text # hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 # hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 # if row.find_element(:xpath => "./td[3]").attribute("class") == " dataCell booleanColumn" # # - get checkbox value # hStep2SubRowResp[aStep2Headers[3]] = !row.find_element(:xpath => "./td[3]/input").attribute("checked").nil? # else # # - Get gender value # hStep2SubRowResp[aStep2Headers[3]] = row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[3]//*").size == 0 # end when 5 # - Find countries that have only five Step 5 Header Columns # - ############################## HERE ############################## if row.find_elements(:xpath => "./td[1]//*").size > 0 if !(row.find_element(:xpath => "./td[1]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) row.find_element(:xpath => "./td[1]/input").clear() row.find_element(:xpath => "./td[1]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[1]]) blnReturn=true end end if row.find_elements(:xpath => "./td[2]//*").size > 0 if !(row.find_element(:xpath => "./td[2]/input").attribute("value") == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) row.find_element(:xpath => "./td[2]/input").clear() row.find_element(:xpath => "./td[2]/input").send_keys(hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[2]]) blnReturn=true end end if row.find_elements(:xpath => "./td[3]//*").size > 0 if !(row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[3]]) row.find_elements(:xpath => "./td[3]/select/option").each do |option| if option.text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[3]] option.click blnReturn=true break end end end end if row.find_element(:xpath => "./td[4]").attribute("class") == " dataCell booleanColumn" # - get checkbox value if !((!row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? ).to_s == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[4]].to_s) row.find_element(:xpath => "./td[4]/input").click blnReturn=true end # hStep2SubRowResp[aStep2Headers[4]] = !row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? else # - Get gender value if row.find_elements(:xpath => "./td[4]//*").size > 0 if !(row.find_element(:xpath => "./td[4]/select/option[@selected='selected']").text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[4]]) row.find_elements(:xpath => "./td[4]/select/option").each do |option| if option.text == hValueSet[sTableType][row.find_element(:xpath => "./th").text][aStep2Headers[4]] option.click blnReturn=true break end end end end # hStep2SubRowResp[aStep2Headers[4]] = row.find_element(:xpath => "./td[4]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[4]//*").size == 0 end # srowFieldLabel=row.find_element(:xpath => "./th").text # hStep2SubRowResp[aStep2Headers[1]]=row.find_element(:xpath => "./td[1]/input").attribute("value") unless row.find_elements(:xpath => "./td[1]//*").size == 0 # hStep2SubRowResp[aStep2Headers[2]]=row.find_element(:xpath => "./td[2]/input").attribute("value") unless row.find_elements(:xpath => "./td[2]//*").size == 0 # hStep2SubRowResp[aStep2Headers[3]]=row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[3]//*").size == 0 # if row.find_element(:xpath => "./td[4]").attribute("class") == " dataCell booleanColumn" # # - get checkbox value # hStep2SubRowResp[aStep2Headers[4]] = !row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? # else # # - Get gender value # hStep2SubRowResp[aStep2Headers[4]] = row.find_element(:xpath => "./td[4]/select/option[@selected='selected']").text unless row.find_elements(:xpath => "./td[4]//*").size == 0 # end end end end iTableCount +=1 end @driver.manage.timeouts.implicit_wait = @implicitWait return blnReturn end
> sObjName = string value of the sharing setting object to return¶ ↑
> hOjbValues = Hash of the values to verify for the sObjName¶ ↑
> Return = true/false¶ ↑
- True if values match - False if values do not match
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 198 def set_SharingSettingAccess_Edit(sObjName, hObjValues) @driver.manage.timeouts.implicit_wait = 0 blnUpdateSuccessful=false $accessHeaders=[] # - Perform Update Actions get_SharingSettingAccessTable_Edit.each_with_index do |row, index| if index == 0 # - Get headers row.find_elements(:xpath => "./th").each do |h| $accessHeaders.push(h.text) end else # - Perform Updates to columns if row.find_element(:xpath => "./td[1]").text == sObjName # - Column: Default Internal Access (dropdown selection) if row.find_elements(:xpath => "./td[2]//*").size > 0 if !(hObjValues[sObjName][$accessHeaders[1]]==row.find_element(:xpath => "./td[2]/select/option[@selected='selected']").text) row.find_elements(:xpath => "./td[2]/select/option").each do |option| if option.text == hObjValues[sObjName][$accessHeaders[1]] option.click unless option.selected? # puts "-- ** Set Default Internal Access **" blnUpdateSuccessful=true end end end end # - Column: Default External Access (dropdown selection) if row.find_elements(:xpath => "./td[3]//*").size > 0 if !(hObjValues[sObjName][$accessHeaders[2]]==row.find_element(:xpath => "./td[3]/select/option[@selected='selected']").text) row.find_elements(:xpath => "./td[3]/select/option").each do |option| if option.text == hObjValues[sObjName][$accessHeaders[1]] option.click unless option.selected? # puts "-- ** Set Default External Access **" blnUpdateSuccessful=true end end end end # - Grant Access Using Hierarchies (checkbox) if row.find_element(:xpath => "./td[4]/input").attribute("disabled").nil? # puts "Checkbox Not Disabled" if (hObjValues[sObjName][$accessHeaders[3]]) == "Checked" row.find_element(:xpath => "./td[4]/input[@type='checkbox']").click unless !row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? blnUpdateSuccessful=true else row.find_element(:xpath => "./td[4]/input[@type='checkbox']").click unless row.find_element(:xpath => "./td[4]/input").attribute("checked").nil? blnUpdateSuccessful=true end # else # puts "Checkbox Disabled" end break end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnUpdateSuccessful end
> sViewName = string value of the Sharing Setting option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 91 def set_SharingSetting_View(sViewName) blnViewSet=false begin get_SharingSettingOptions.each do |option| if option.text == sViewName option.click unless option.selected? blnViewSet=true return blnViewSet end end rescue puts $! puts $@ end return blnViewSet end
# File lib/sfdc_se/pages/page_translate.rb, line 159 def set_Translation_Aspect(sAspect) blnReturn=false begin get_Translate_Aspect.each do |option| if option.text == sAspect option.click unless option.selected? blnReturn=true sleep(3) break end end rescue puts $! puts $@ end return blnReturn end
set_Translation_CustomReportTypeEntity
> sEntityType = string value of the Translate Custom Report Type Entity option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 132 def set_Translation_CustomReportTypeEntity(sEntityType) blnReturn=false begin get_Translate_CustomReportTypeEntity.each do |option| if option.text == sEntityType option.click unless option.selected? blnReturn=true sleep(3) break end end rescue puts $! puts $@ end return blnReturn end
set_Translation_CustomReportType_Description
> Return = true/false¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 280 def set_Translation_CustomReportType_Description(sCustomReportTypeName, sTranslationValue) blnReturn=false blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sCustomReportTypeName if !(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text == sTranslationValue) @driver.action.double_click(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div")).perform @driver.find_element(:id => "txtEdField").clear() @driver.find_element(:id => "txtEdField").send_keys(sTranslationValue) blnReturn=true end # response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return blnReturn # return response end
set_Translation_CustomReportType_FieldLabel
> Return = true/false¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 214 def set_Translation_CustomReportType_FieldLabel(sCustomReportTypeName, sTranslationValue) blnReturn=false blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sCustomReportTypeName if !(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text == sTranslationValue) @driver.action.double_click(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div")).perform @driver.find_element(:id => "txtEdField").clear() @driver.find_element(:id => "txtEdField").send_keys(sTranslationValue) blnReturn=true end blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return blnReturn end
set_Translation_CustomReportType_LayoutSection
> Return = true / false¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 350 def set_Translation_CustomReportType_LayoutSection(sMasterLayoutSection, sCustomReportTypeName, sTranslationValue) blnReturn=false blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sMasterLayoutSection and get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[3]/div").text == sCustomReportTypeName if !(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text == sTranslationValue) @driver.action.double_click(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div")).perform @driver.find_element(:id => "txtEdField").clear() @driver.find_element(:id => "txtEdField").send_keys(sTranslationValue) blnReturn=true end blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return blnReturn end
> sLanguage = string value of the Translate Language option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 78 def set_Translation_Language(sLanguage) blnReturn=false begin get_Translate_Language.each do |option| if option.text == sLanguage option.click unless option.selected? blnReturn=true sleep(3) break end end rescue puts $! puts $@ end return blnReturn end
> Return = true/ false¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 416 def set_Translation_RecordType(sMasterRecordTypeLabel, sTranslationValue) blnReturn=false blnFound=false idx=0 until (@driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i and idx==@driver.find_element(:id => 'totalPages').text.to_i) or blnFound==true r=0 while r < get_Translate_CustomReportType_FieldLabel_rows.length if get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[1]/div").text == sMasterRecordTypeLabel if !(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text == sTranslationValue) @driver.action.double_click(get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div")).perform @driver.find_element(:id => "txtEdField").clear() @driver.find_element(:id => "txtEdField").send_keys(sTranslationValue) blnReturn=true end # response["translation"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[2]/div").text # response["out of Date"]=get_Translate_CustomReportType_FieldLabel_rows[r].find_element(:xpath => "./table/tbody/tr/td[4]/div/div/input").selected? #attribute("checked") blnFound=true break end r+=1 end idx+=1 if blnFound==false get_btn_Translate_CustomReportType_FieldLabel_Next.click unless @driver.find_element(:id => 'pageNumField').attribute("value").to_i == @driver.find_element(:id => 'totalPages').text.to_i sleep(5) end end return blnReturn end
set_Translation_SetupComponent
> sComponentName = string value of the Translate Setup Component option to select¶ ↑
> Return = true or false¶ ↑
> true = setting of view were successful¶ ↑
> false = setting of view had an error¶ ↑
# File lib/sfdc_se/pages/page_translate.rb, line 105 def set_Translation_SetupComponent(sComponentName) blnReturn=false begin get_Translate_SetupComponent.each do |option| if option.text == sComponentName option.click unless option.selected? blnReturn=true sleep(3) break end end rescue puts $! puts $@ end return blnReturn end
set_selection_AccessLevel
> value = string of the value to select in the dropdown¶ ↑
> returns the selected value¶ ↑
# File lib/sfdc_se/pages/page_deliverability.rb, line 45 def set_selection_Devliverability_AccessLevel(value) options=get_elements_Devliverability_AccessLevel options.each do |option_s| if option_s.text == value option_s.click return option_s.text end end end
Header Logo Verification
# File lib/sfdc_se.rb, line 107 def verify_HeaderLogoExists if @driver.find_elements(:id => "phHeaderLogoImage").size > 0 return true else return false end end
> sObjName = string value of the sharing setting object to return¶ ↑
> hOjbValues = Hash of the values to verify for the sObjName¶ ↑
> Return = true/false¶ ↑
- True if values match - False if values do not match
# File lib/sfdc_se/pages/page_sharingsettings.rb, line 145 def verify_SharingSettingsAccess(sObjName, hObjValues) @driver.manage.timeouts.implicit_wait = 0 blnVerify=true $accessHeaders=[] # hObjValues[sObjName].each do |k,v| # puts "\t\t#{k}: #{v}" # end get_SharingSettingAccessTable.each_with_index do |row, index| if index == 0 # - Get headers row.find_elements(:xpath => "./th").each do |h| $accessHeaders.push(h.text) end else # Check values against hObjValues if row.find_element(:xpath => "./th").text == sObjName if !(hObjValues[sObjName][$accessHeaders[1]]==row.find_element(:xpath => "./td[1]").text) puts "#{$accessHeaders[1]}: #{hObjValues[sObjName][$accessHeaders[1]]} | #{row.find_element(:xpath => "./td[1]").text}" blnVerify=false end if !(hObjValues[sObjName][$accessHeaders[2]]==row.find_element(:xpath => "./td[2]").text) puts "#{$accessHeaders[2]}: #{hObjValues[sObjName][$accessHeaders[2]]} | #{row.find_element(:xpath => "./td[2]").text}" blnVerify=false end if row.find_elements(:xpath => "./td[3]//*").size > 0 if !(hObjValues[sObjName][$accessHeaders[3]]==row.find_element(:xpath => "./td/img").attribute("title")) puts "#{$accessHeaders[3]}: #{hObjValues[sObjName][$accessHeaders[3]]} | #{row.find_element(:xpath => "./td/img").attribute("title")}" blnVerify=false end end break end end end @driver.manage.timeouts.implicit_wait = @implicitWait return blnVerify end