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

Make tag name optional in dynamic element locator #491

Open
jkotests opened this issue Oct 8, 2019 · 1 comment
Open

Make tag name optional in dynamic element locator #491

jkotests opened this issue Oct 8, 2019 · 1 comment

Comments

@jkotests
Copy link
Collaborator

jkotests commented Oct 8, 2019

As noted in a recent Stack Overflow question, the dynamic element locator requires the tag name to be specified. This is pretty awkward looking when the tag name is unknown:

class MyPage
  include PageObject

  def do_stuff
    element('element', class: 'class_name').text
  end
end

We should make the tag name optional. Instead the tag name should be specified like any other locator:

# When the tag name is unknown
element(class: 'class_name')

# When the tag name is known
element(tag_name: 'custom_tag', class: 'class_name')
@jkotests
Copy link
Collaborator Author

This is complicated by the fact that the "tag" is actually used to determine the corresponding Watir method - see https://stackoverflow.com/a/59076811/1200545.

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

No branches or pull requests

1 participant