{"action":"created","issue":{"url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/41","repository_url":"https://api.github.com/repos/spriteCloud/lapis-lazuli","labels_url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/41/comments","events_url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/41/events","html_url":"https://github.com/spriteCloud/lapis-lazuli/issues/41","id":191253367,"number":41,"title":"multi_find_all() only lists the elements with the first successfull selector","user":{"login":"sjieg","id":5168683,"avatar_url":"https://avatars.githubusercontent.com/u/5168683?v=3","gravatar_id":"","url":"https://api.github.com/users/sjieg","html_url":"https://github.com/sjieg","followers_url":"https://api.github.com/users/sjieg/followers","following_url":"https://api.github.com/users/sjieg/following{/other_user}","gists_url":"https://api.github.com/users/sjieg/gists{/gist_id}","starred_url":"https://api.github.com/users/sjieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjieg/subscriptions","organizations_url":"https://api.github.com/users/sjieg/orgs","repos_url":"https://api.github.com/users/sjieg/repos","events_url":"https://api.github.com/users/sjieg/events{/privacy}","received_events_url":"https://api.github.com/users/sjieg/received_events","type":"User","site_admin":false},"labels":[{"id":69966373,"url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"sjieg","id":5168683,"avatar_url":"https://avatars.githubusercontent.com/u/5168683?v=3","gravatar_id":"","url":"https://api.github.com/users/sjieg","html_url":"https://github.com/sjieg","followers_url":"https://api.github.com/users/sjieg/followers","following_url":"https://api.github.com/users/sjieg/following{/other_user}","gists_url":"https://api.github.com/users/sjieg/gists{/gist_id}","starred_url":"https://api.github.com/users/sjieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjieg/subscriptions","organizations_url":"https://api.github.com/users/sjieg/orgs","repos_url":"https://api.github.com/users/sjieg/repos","events_url":"https://api.github.com/users/sjieg/events{/privacy}","received_events_url":"https://api.github.com/users/sjieg/received_events","type":"User","site_admin":false},"assignees":[{"login":"sjieg","id":5168683,"avatar_url":"https://avatars.githubusercontent.com/u/5168683?v=3","gravatar_id":"","url":"https://api.github.com/users/sjieg","html_url":"https://github.com/sjieg","followers_url":"https://api.github.com/users/sjieg/followers","following_url":"https://api.github.com/users/sjieg/following{/other_user}","gists_url":"https://api.github.com/users/sjieg/gists{/gist_id}","starred_url":"https://api.github.com/users/sjieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjieg/subscriptions","organizations_url":"https://api.github.com/users/sjieg/orgs","repos_url":"https://api.github.com/users/sjieg/repos","events_url":"https://api.github.com/users/sjieg/events{/privacy}","received_events_url":"https://api.github.com/users/sjieg/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-11-23T12:03:40Z","updated_at":"2016-11-23T12:15:35Z","closed_at":null,"body":"``` Ruby\r\nirb\r\nrequire 'lapis_lazuli'\r\ninclude LapisLazuli\r\nbrowser.goto 'google.com'\r\n\r\nbrowser.multi_find_all(\r\n  :selectors => [\r\n    {:element => {:text => 'Google'}},\r\n    {:a => {:text => 'Afbeelding'}},\r\n    {:a => {:text => 'Gmail'}}\r\n  ],\r\n  :mode => :match_one\r\n).length\r\n# Expected:7, Actual: 3\r\n\r\nbrowser.multi_find_all(\r\n  :selectors => [\r\n    {:a => {:text => 'Gmail'}},\r\n    {:element => {:text => 'Google'}},\r\n    {:a => {:text => 'Afbeelding'}}\r\n  ],\r\n  :mode => :match_one\r\n).length\r\n# Expected:3, Actual: 2\r\n```\r\n\r\nmulti_find_all() seems to stop looking for the other selectors once it has found a result. So if the first selector has zero results, then it will find_all for the second selector, and so on."},"comment":{"url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/comments/262498338","html_url":"https://github.com/spriteCloud/lapis-lazuli/issues/41#issuecomment-262498338","issue_url":"https://api.github.com/repos/spriteCloud/lapis-lazuli/issues/41","id":262498338,"user":{"login":"sjieg","id":5168683,"avatar_url":"https://avatars.githubusercontent.com/u/5168683?v=3","gravatar_id":"","url":"https://api.github.com/users/sjieg","html_url":"https://github.com/sjieg","followers_url":"https://api.github.com/users/sjieg/followers","following_url":"https://api.github.com/users/sjieg/following{/other_user}","gists_url":"https://api.github.com/users/sjieg/gists{/gist_id}","starred_url":"https://api.github.com/users/sjieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjieg/subscriptions","organizations_url":"https://api.github.com/users/sjieg/orgs","repos_url":"https://api.github.com/users/sjieg/repos","events_url":"https://api.github.com/users/sjieg/events{/privacy}","received_events_url":"https://api.github.com/users/sjieg/received_events","type":"User","site_admin":false},"created_at":"2016-11-23T12:15:35Z","updated_at":"2016-11-23T12:15:35Z","body":"That will cause the find to fail because it trying to look for an element that has all 3 of the selectors to be true,, which will be never.\r\n\r\nAccording to the documentation `:match_all` means that the elements found should match all the given selectors. `:match_one` means that it should match any one of the given selectors. So the difference is in `_all` where you expect all the elements to be given that match either one of the selectors.\r\n\r\nSidenote: If an element matches 2 of the 3 selectors, then it should be listed only once in the returned array."}}
{"actor":{"display_login":"sjieg"}}