{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/184405589","pull_request_review_id":115594898,"id":184405589,"diff_hunk":"@@ -41,52 +41,62 @@ async function getScreenshotWithIdevicelib (udid, isLandscape) {\n   }\n }\n \n-async function isIdevicescreenshotAvailable () {\n-  return !!(await fs.which('idevicescreenshot'));\n+async function verifyIdeviceScreenshotAvailable () {\n+  try {\n+    await fs.which('idevicescreenshot');\n+  } catch (err) {\n+    throw new Error(`No 'idevicescreenshot' program found. To use, install ` +\n+                    `using 'brew install --HEAD libimobiledevice'`);\n+  }\n }\n \n commands.getScreenshot = async function () {\n+  const getScreenshotFromIDS = async () => {\n+    log.debug(`Taking screenshot with 'idevicescreenshot'`);\n+    await verifyIdeviceScreenshotAvailable();\n+    const orientation = await this.proxyCommand('/orientation', 'GET');\n+    return await getScreenshotWithIdevicelib(this.opts.udid, orientation === 'LANDSCAPE');\n+  };\n   const getScreenshotFromWDA = async () => {\n+    log.debug(`Taking screenshot with WDA`);\n     const data = await this.proxyCommand('/screenshot', 'GET');\n     if (!_.isString(data)) {\n       throw new Error(`Unable to take screenshot. WDA returned '${JSON.stringify(data)}'`);\n     }\n     return data;\n   };\n \n+  const useIdeviceScreenshot = _.lowerCase(this.opts.realDeviceScreenshotter) === 'idevicescreenshot';\n+  if (useIdeviceScreenshot) {\n+    return await getScreenshotFromIDS();","path":"lib/commands/screenshots.js","position":33,"original_position":33,"commit_id":"e339f4cc5e8d28f4006be54fbaf2c168cca8dbdd","original_commit_id":"e339f4cc5e8d28f4006be54fbaf2c168cca8dbdd","user":{"login":"imurchie","id":2614354,"avatar_url":"https://avatars2.githubusercontent.com/u/2614354?v=4","gravatar_id":"","url":"https://api.github.com/users/imurchie","html_url":"https://github.com/imurchie","followers_url":"https://api.github.com/users/imurchie/followers","following_url":"https://api.github.com/users/imurchie/following{/other_user}","gists_url":"https://api.github.com/users/imurchie/gists{/gist_id}","starred_url":"https://api.github.com/users/imurchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imurchie/subscriptions","organizations_url":"https://api.github.com/users/imurchie/orgs","repos_url":"https://api.github.com/users/imurchie/repos","events_url":"https://api.github.com/users/imurchie/events{/privacy}","received_events_url":"https://api.github.com/users/imurchie/received_events","type":"User","site_admin":false},"body":"I can't reproduce, and don't have access to the app that is causing the problems.","created_at":"2018-04-26T14:16:18Z","updated_at":"2018-04-26T14:16:18Z","html_url":"https://github.com/appium/appium-xcuitest-driver/pull/655#discussion_r184405589","pull_request_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/184405589"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/655#discussion_r184405589"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655"}},"in_reply_to_id":184289504},"pull_request":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655","id":183913993,"html_url":"https://github.com/appium/appium-xcuitest-driver/pull/655","diff_url":"https://github.com/appium/appium-xcuitest-driver/pull/655.diff","patch_url":"https://github.com/appium/appium-xcuitest-driver/pull/655.patch","issue_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/655","number":655,"state":"open","locked":false,"title":"Add cap to use idevicescreenshot for real device screenshots","user":{"login":"imurchie","id":2614354,"avatar_url":"https://avatars2.githubusercontent.com/u/2614354?v=4","gravatar_id":"","url":"https://api.github.com/users/imurchie","html_url":"https://github.com/imurchie","followers_url":"https://api.github.com/users/imurchie/followers","following_url":"https://api.github.com/users/imurchie/following{/other_user}","gists_url":"https://api.github.com/users/imurchie/gists{/gist_id}","starred_url":"https://api.github.com/users/imurchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imurchie/subscriptions","organizations_url":"https://api.github.com/users/imurchie/orgs","repos_url":"https://api.github.com/users/imurchie/repos","events_url":"https://api.github.com/users/imurchie/events{/privacy}","received_events_url":"https://api.github.com/users/imurchie/received_events","type":"User","site_admin":false},"body":"The flow for screenshotting on real devices as it currently stands:\r\n1. Try WDA method (i.e., `GET` request to `/screenshot` on WDA)\r\n2. Try `idevicescreenshot` if available\r\n3. Try WDA method an additional two times\r\n\r\nHowever, there are reported cases where WDA still crashes when getting screenshots\r\n\r\nThis PR\r\n* Adds `realDeviceScreenshotter` cap to specify the program to use preferentially (for now, either nothing, to use WDA first, or `idevicescreenshot` to use the `libimobiledevice` program). In the former case, the flow remains as above. In the case of using `idevicescreenshot` the flow becomes\r\n    1. Try `idevicescreenshot` if available\r\n* Fixes handling of existence of `idevicescreenshot` (`fs.which` throws an error when program not found)\r\n\r\nResolves https://github.com/appium/appium/issues/10590","created_at":"2018-04-25T03:01:42Z","updated_at":"2018-04-26T14:16:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae00d0f87d80481a13b8a7bfc4107d45640f248e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655/commits","review_comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655/comments","review_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/655/comments","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/e339f4cc5e8d28f4006be54fbaf2c168cca8dbdd","head":{"label":"appium:isaac-screenshot","ref":"isaac-screenshot","sha":"e339f4cc5e8d28f4006be54fbaf2c168cca8dbdd","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":47652761,"name":"appium-xcuitest-driver","full_name":"appium/appium-xcuitest-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":false,"url":"https://api.github.com/repos/appium/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/deployments","created_at":"2015-12-08T22:11:37Z","updated_at":"2018-04-26T14:00:59Z","pushed_at":"2018-04-26T14:00:59Z","git_url":"git://github.com/appium/appium-xcuitest-driver.git","ssh_url":"git@github.com:appium/appium-xcuitest-driver.git","clone_url":"https://github.com/appium/appium-xcuitest-driver.git","svn_url":"https://github.com/appium/appium-xcuitest-driver","homepage":null,"size":25608,"stargazers_count":202,"watchers_count":202,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":152,"open_issues":2,"watchers":202,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"4cb4fb2ab9301838a96d818c4ff5b275dbef045d","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":47652761,"name":"appium-xcuitest-driver","full_name":"appium/appium-xcuitest-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":false,"url":"https://api.github.com/repos/appium/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/deployments","created_at":"2015-12-08T22:11:37Z","updated_at":"2018-04-26T14:00:59Z","pushed_at":"2018-04-26T14:00:59Z","git_url":"git://github.com/appium/appium-xcuitest-driver.git","ssh_url":"git@github.com:appium/appium-xcuitest-driver.git","clone_url":"https://github.com/appium/appium-xcuitest-driver.git","svn_url":"https://github.com/appium/appium-xcuitest-driver","homepage":null,"size":25608,"stargazers_count":202,"watchers_count":202,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":152,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":152,"open_issues":2,"watchers":202,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/655"},"issue":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/655"},"comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/655/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/655/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/e339f4cc5e8d28f4006be54fbaf2c168cca8dbdd"}},"author_association":"OWNER"}}
{"actor":{"display_login":"imurchie"}}