Skip to content

Commit 89a55e4

Browse files
author
Tim Connor
committed
Allow missing elements to be inspected
1 parent 013d705 commit 89a55e4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/ae_page_objects/element_proxy.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ def method_missing(name, *args, &block)
103103
end
104104

105105
implicit_element.__send__(name, *args, &block)
106+
rescue AePageObjects::LoadingElementFailed
107+
raise unless %w(to_s inspect).include? name.to_sym
108+
109+
# The element is being serialized for debug / warning purposes. In
110+
# this situation it is a valid case that the element may not exist so
111+
# instead of raising an error just return a string indicating that the
112+
# element does not exist.
113+
'[element not found]'
106114
end
107115

108116
def respond_to?(*args)

0 commit comments

Comments
 (0)