{"action":"created","issue":{"url":"https://api.github.com/repos/watir/watir/issues/466","repository_url":"https://api.github.com/repos/watir/watir","labels_url":"https://api.github.com/repos/watir/watir/issues/466/labels{/name}","comments_url":"https://api.github.com/repos/watir/watir/issues/466/comments","events_url":"https://api.github.com/repos/watir/watir/issues/466/events","html_url":"https://github.com/watir/watir/pull/466","id":176515390,"number":466,"title":"implement visible filter","user":{"login":"titusfortner","id":777185,"avatar_url":"https://avatars.githubusercontent.com/u/777185?v=3","gravatar_id":"","url":"https://api.github.com/users/titusfortner","html_url":"https://github.com/titusfortner","followers_url":"https://api.github.com/users/titusfortner/followers","following_url":"https://api.github.com/users/titusfortner/following{/other_user}","gists_url":"https://api.github.com/users/titusfortner/gists{/gist_id}","starred_url":"https://api.github.com/users/titusfortner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titusfortner/subscriptions","organizations_url":"https://api.github.com/users/titusfortner/orgs","repos_url":"https://api.github.com/users/titusfortner/repos","events_url":"https://api.github.com/users/titusfortner/events{/privacy}","received_events_url":"https://api.github.com/users/titusfortner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-13T00:03:19Z","updated_at":"2016-09-13T02:59:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/watir/watir/pulls/466","html_url":"https://github.com/watir/watir/pull/466","diff_url":"https://github.com/watir/watir/pull/466.diff","patch_url":"https://github.com/watir/watir/pull/466.patch"},"body":"I was going to call this :hidden, but I see that Capybara implements this as :visible, which makes more sense.\r\n\r\nThis comes up as more and more sites implement as Single Page Apps. For instance there might be a single login page that has modals for both signing in and signing up. They share the same classes and names for elements in the form, but one is visible and the other is hidden. Sometimes it is easy to grab an id from the form or the top element of a modal and do something like:\r\n```ruby\r\nmodal = browser.div(id: \"sign-in-modal\")\r\nusername = modal.text_field(name: \"username\")\r\n```\r\nSometimes it is not easy. This would be easier than using indexes, and would allow you to use the same page object (versus subclassing) for both of these when the names of the fields and the actions for each are the same.\r\n\r\nAlso, I can't figure out how to get the mocks to work in the `element_locator_spec` with this updated implementation, so I'm going to need help with that. :)\r\n\r\nThe specs need html elements found here: https://github.com/watir/watirspec/pull/91"},"comment":{"url":"https://api.github.com/repos/watir/watir/issues/comments/246559501","html_url":"https://github.com/watir/watir/pull/466#issuecomment-246559501","issue_url":"https://api.github.com/repos/watir/watir/issues/466","id":246559501,"user":{"login":"p0deje","id":665846,"avatar_url":"https://avatars.githubusercontent.com/u/665846?v=3","gravatar_id":"","url":"https://api.github.com/users/p0deje","html_url":"https://github.com/p0deje","followers_url":"https://api.github.com/users/p0deje/followers","following_url":"https://api.github.com/users/p0deje/following{/other_user}","gists_url":"https://api.github.com/users/p0deje/gists{/gist_id}","starred_url":"https://api.github.com/users/p0deje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p0deje/subscriptions","organizations_url":"https://api.github.com/users/p0deje/orgs","repos_url":"https://api.github.com/users/p0deje/repos","events_url":"https://api.github.com/users/p0deje/events{/privacy}","received_events_url":"https://api.github.com/users/p0deje/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T02:59:44Z","updated_at":"2016-09-13T02:59:44Z","body":"That is actually quite interesting. At some point I was thinking about something like that - allowing predicate method locators (`visible: true`, `selected: 'text'`, etc.) but decided to implement it in [watirsome](https://github.com/p0deje/watirsome#locators) and keep using that. Having something like that in Watir might actually help users, so I have nothing against merging it."}}
{"actor":{"display_login":"p0deje"}}