class LdsBlockInSummaryView
Public Instance Methods
elementExists?(idElement)
click to toggle source
# 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()
click to toggle source
internal methods
# File lib/TNR360/components/lds_block_in_summary_view.rb, line 74 def extractAreas end
extractTitle()
click to toggle source
# 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)
click to toggle source
method locate current element
# 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)
click to toggle source
# 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)
click to toggle source
# 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()
click to toggle source
private method to update/save the status of the object
# 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