Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method `wait_until_has_element_name' #2

Closed
ArtemVarnavskiy opened this issue May 30, 2019 · 6 comments
Closed

Comments

@ArtemVarnavskiy
Copy link

class LoginPage < Appom::Page

element :input_login, :xpath, "//XCUIElementTypeTextField"

def authorization(login)
wait_until_has_input_login
input_login.send_keys(login)
end

end

Problem
When i call a method authorization(login), i get error:

undefined local variable or method `wait_until_has_input_login' for #LoginPage:0x00007fa744613788
Did you mean? wait_until_get_not_empty (NameError)

@hoangtaiki
Copy link
Owner

@ArtemVarnavskiy Please rename it to has_input_login

@hoangtaiki
Copy link
Owner

hoangtaiki commented May 31, 2019

I rename this function to has_element

##
# Check element exist
# We will try to find all elements with *find_args
# Condition is pass when response is not empty
#
def create_existence_checker(element_name, *find_args)
  method_name = "has_#{element_name}"
  create_helper_method(method_name, *find_args) do
    define_method(method_name) do |*runtime_args|
      args = merge_args(find_args, runtime_args)
      wait_until('at least one element exists', *args)
    end
  end
end

@ArtemVarnavskiy
Copy link
Author

@hoangtaiki Thank! It works

@ArtemVarnavskiy
Copy link
Author

@hoangtaiki It would be great if could use Explicit Wait for has_no_element
example:
has_no_element(10)

@hoangtaiki
Copy link
Owner

hoangtaiki commented May 31, 2019

Great idea. I will create an issue and implement it.

@hoangtaiki
Copy link
Owner

@ArtemVarnavskiy I will implement it in this issue
#3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants