Skip to content

Instantly share code, notes, and snippets.

@titusfortner
Created September 1, 2015 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save titusfortner/92c2eba8cd6a496c62cf to your computer and use it in GitHub Desktop.
Save titusfortner/92c2eba8cd6a496c62cf to your computer and use it in GitHub Desktop.
Monkey Patches
def find_element_by(how, what, parent = nil)
if protractor.finder? how
return protractor_find(false, how, what, parent)
end
if parent
id = execute :findChildElement, { :id => parent }, { :using => how, :value => what }
else
id = execute :findElement, {}, { :using => how, :value => what }
end
Element.new self, element_id_from(id)
end
def find_element_by(how, what, parent = nil)
if parent
id = execute :findChildElement, {:id => parent}, {:using => how, :value => what}
else
id = execute :findElement, {}, {:using => how, :value => what}
end
Element.new self, element_id_from(id)
end
alias_method :se_find_element_by, :find_element_by
def find_element_by(how, what, parent = nil)
if protractor.finder? how
protractor_find(false, how, what, parent)
else
se_find_element_by(how, what, parent)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment