Class: LdsBlockInSummaryView
- Defined in:
- lib/TNR360/components/lds_block_in_summary_view.rb
Instance Method Summary collapse
- #elementExists?(idElement) ⇒ Boolean
-
#extractAreas ⇒ Object
internal methods.
- #extractTitle ⇒ Object
-
#findElement(idElement) ⇒ Object
method locate current element.
- #getLabel(idF) ⇒ Object
- #getValue(idF) ⇒ Object
-
#update ⇒ Object
private method to update/save the status of the object.
Methods inherited from LdsBlock
#collapse, #expand, #getAreas, #getElement, #getIdBlock, #getIdScreen, #getTitle, #getType, #hasMultipleAreas?, #initialize, #isCollapsed?, #isCollapsible?, #isExist?, #isScreenDisplayed, #isVisible?, #refresh, #reverse_collapse, #to_s
Constructor Details
This class inherits a constructor from LdsBlock
Instance Method Details
#elementExists?(idElement) ⇒ Boolean
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 48 def elementExists?(idElement) #this method assumes the screen/tab is already loaded oneIsVisible=false #if element not yet available in screen, wait for some time if (!@browser.div(:id => idElement).exists?) @browser.div(:id => idElement).when_present(10) oneIsVisible=true else if (!@browser.div(:id => idElement).visible?) @browser.divs(:id => idElement).each do |field| if field.visible? oneIsVisible=true break end end if !oneIsVisible @browser.div(:id => idElement).when_present(10) oneIsVisible=true end else oneIsVisible=true end end oneIsVisible end |
#extractAreas ⇒ Object
internal methods
74 75 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 74 def extractAreas end |
#extractTitle ⇒ Object
76 77 78 79 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 76 def extractTitle @title=@current_element.parent.parent.span.text puts @title end |
#findElement(idElement) ⇒ Object
method locate current element
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 18 def findElement idElement @current_element=nil #wait for screen to become visible (find screen forcefully) proc=Proc.new { isScreenDisplayed } force_find_element(proc).to_s #wait for screen to become visible (find screen forcefully) proc=Proc.new { elementExists?(idElement) } @exists=force_find_element(proc) puts 'Block found = '+@exists.to_s if (@browser.divs(:id => idElement).length>1) @browser.divs(:id => idElement).each do |field| if field.visible? @current_element=field break end end else @current_element=@browser.div(:id => idElement).when_present end if @current_element.visible? puts 'block is visible' else puts 'block is NOT visible' end @current_element end |
#getLabel(idF) ⇒ Object
80 81 82 83 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 80 def getLabel idF @label=@current_element.div(:id=>idF).parent.parent.label.text puts @label end |
#getValue(idF) ⇒ Object
85 86 87 88 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 85 def getValue idF @value=@current_element.div(:id=>idF).text puts @value end |
#update ⇒ Object
private method to update/save the status of the object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/TNR360/components/lds_block_in_summary_view.rb', line 5 def update @exists=false #Look for element in browser @current_element||= findElement @idBlock #fill @title extractTitle #fill type extractType #everything exists @exists=true end |