Fixed ff issue with selenium - element is not currently visible on empty search.

This commit is contained in:
Martin Edenhofer 2016-03-15 11:24:42 +01:00
parent 1cb04adb95
commit 360dc08c03

View file

@ -1199,6 +1199,39 @@ wait untill text in selector disabppears
assert(true, 'all tasks closed')
end
=begin
empty_search(
browser: browser1,
)
=end
def empty_search(params = {})
switch_window_focus(params)
log('empty_search', params)
instance = params[:browser] || @browser
# empty search box by x
begin
instance.find_elements(css: '.search .empty-search')[0].click
rescue
# in issues with ff & selenium, sometimes exeption appears
# "Element is not currently visible and so may not be interacted with"
log('empty_search via js')
instance.execute_script('$(".search .empty-search").click()')
end
sleep 0.5
text = instance.find_elements(css: '#global-search')[0].attribute('value')
if !text
raise '#global-search is not empty!'
end
true
end
=begin
ticket_customer_select(
@ -1846,13 +1879,7 @@ wait untill text in selector disabppears
element.send_keys(params[:number])
sleep 3
# empty search box by x
instance.find_elements(css: '.search .empty-search .icon')[0].click
sleep 0.5
text = instance.find_elements(css: '#global-search')[0].attribute('value')
if !text
raise '#global-search is not empty!'
end
empty_search(browser: instance)
# search by number again
element = instance.find_elements(css: '#global-search')[0]
@ -1975,12 +2002,9 @@ wait untill text in selector disabppears
element.clear
element.send_keys(params[:value])
sleep 3
instance.find_elements(css: '.search .empty-search .icon')[0].click
sleep 0.5
text = instance.find_elements(css: '#global-search')[0].attribute('value')
if !text
raise '#global-search is not empty!'
end
empty_search(browser: instance)
element = instance.find_elements(css: '#global-search')[0]
element.click
element.clear