{"action":"created","comment":{"url":"https://api.github.com/repos/scrapinghub/splash/pulls/comments/61142094","id":61142094,"diff_hunk":"@@ -870,6 +870,23 @@ def _post_mouse_event(self, type, button, x, y):\n         event = QMouseEvent(type, point, q_button, buttons, modifiers)\n         QApplication.postEvent(self.web_page, event)\n \n+    def send_keys(self, text, key_type=None):\n+        \"\"\"\n+        Send key events to webpage\n+        :param text string to be sent as key strokes\n+        :param key_type string representing the pressed key\n+        :return: None\n+        \"\"\"\n+        key_type = key_type or 'unknown'\n+        # http://doc.qt.io/qt-5/qt.html#Key-enum\n+        key_type = getattr(Qt, 'Key_%s' % key_type, Qt.Key_unknown)\n+        self._send_keys(text, key_type)\n+\n+    def _send_keys(self, text, key_type):\n+        modifiers = QApplication.keyboardModifiers()\n+        event = QKeyEvent(QEvent.KeyPress, key_type, modifiers, text)\n+        QApplication.postEvent(self.web_page, event)","path":"splash/browser_tab.py","position":28,"original_position":28,"commit_id":"f0a4e55650fa3db59c65fdcd857d34c7bd3442b6","original_commit_id":"f0a4e55650fa3db59c65fdcd857d34c7bd3442b6","user":{"login":"eskerda","id":208952,"avatar_url":"https://avatars.githubusercontent.com/u/208952?v=3","gravatar_id":"","url":"https://api.github.com/users/eskerda","html_url":"https://github.com/eskerda","followers_url":"https://api.github.com/users/eskerda/followers","following_url":"https://api.github.com/users/eskerda/following{/other_user}","gists_url":"https://api.github.com/users/eskerda/gists{/gist_id}","starred_url":"https://api.github.com/users/eskerda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eskerda/subscriptions","organizations_url":"https://api.github.com/users/eskerda/orgs","repos_url":"https://api.github.com/users/eskerda/repos","events_url":"https://api.github.com/users/eskerda/events{/privacy}","received_events_url":"https://api.github.com/users/eskerda/received_events","type":"User","site_admin":false},"body":"We could of course send each letter on a loop, but that might not be straightforward. What about special characters or acutes. It would be quite similar as: \"an unknown key that when pressed inputs `â`\".\r\n\r\nIMHO `Key_unknown` as a single \"magic\" key works. We can improve it later if there's the use case of actually needing an accurate keyboard simulation.","created_at":"2016-04-26T18:46:34Z","updated_at":"2016-04-26T18:46:34Z","html_url":"https://github.com/scrapinghub/splash/pull/447#discussion_r61142094","pull_request_url":"https://api.github.com/repos/scrapinghub/splash/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/comments/61142094"},"html":{"href":"https://github.com/scrapinghub/splash/pull/447#discussion_r61142094"},"pull_request":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/scrapinghub/splash/pulls/447","id":67340727,"html_url":"https://github.com/scrapinghub/splash/pull/447","diff_url":"https://github.com/scrapinghub/splash/pull/447.diff","patch_url":"https://github.com/scrapinghub/splash/pull/447.patch","issue_url":"https://api.github.com/repos/scrapinghub/splash/issues/447","number":447,"state":"open","locked":false,"title":"Add splash:send_keys() method","user":{"login":"eskerda","id":208952,"avatar_url":"https://avatars.githubusercontent.com/u/208952?v=3","gravatar_id":"","url":"https://api.github.com/users/eskerda","html_url":"https://github.com/eskerda","followers_url":"https://api.github.com/users/eskerda/followers","following_url":"https://api.github.com/users/eskerda/following{/other_user}","gists_url":"https://api.github.com/users/eskerda/gists{/gist_id}","starred_url":"https://api.github.com/users/eskerda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eskerda/subscriptions","organizations_url":"https://api.github.com/users/eskerda/orgs","repos_url":"https://api.github.com/users/eskerda/repos","events_url":"https://api.github.com/users/eskerda/events{/privacy}","received_events_url":"https://api.github.com/users/eskerda/received_events","type":"User","site_admin":false},"body":"This set of commits adds support for native send_keys method.","created_at":"2016-04-21T11:50:00Z","updated_at":"2016-04-26T18:46:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d18fc4b84d3ce0b6ec238ca6fa5835775b0516de","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapinghub/splash/pulls/447/commits","review_comments_url":"https://api.github.com/repos/scrapinghub/splash/pulls/447/comments","review_comment_url":"https://api.github.com/repos/scrapinghub/splash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrapinghub/splash/issues/447/comments","statuses_url":"https://api.github.com/repos/scrapinghub/splash/statuses/f0a4e55650fa3db59c65fdcd857d34c7bd3442b6","head":{"label":"scrapinghub:add-splash-sendkeys","ref":"add-splash-sendkeys","sha":"f0a4e55650fa3db59c65fdcd857d34c7bd3442b6","user":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"repo":{"id":10182205,"name":"splash","full_name":"scrapinghub/splash","owner":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapinghub/splash","description":"Lightweight, scriptable browser as a service with an HTTP API","fork":false,"url":"https://api.github.com/repos/scrapinghub/splash","forks_url":"https://api.github.com/repos/scrapinghub/splash/forks","keys_url":"https://api.github.com/repos/scrapinghub/splash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapinghub/splash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapinghub/splash/teams","hooks_url":"https://api.github.com/repos/scrapinghub/splash/hooks","issue_events_url":"https://api.github.com/repos/scrapinghub/splash/issues/events{/number}","events_url":"https://api.github.com/repos/scrapinghub/splash/events","assignees_url":"https://api.github.com/repos/scrapinghub/splash/assignees{/user}","branches_url":"https://api.github.com/repos/scrapinghub/splash/branches{/branch}","tags_url":"https://api.github.com/repos/scrapinghub/splash/tags","blobs_url":"https://api.github.com/repos/scrapinghub/splash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapinghub/splash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapinghub/splash/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapinghub/splash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapinghub/splash/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapinghub/splash/languages","stargazers_url":"https://api.github.com/repos/scrapinghub/splash/stargazers","contributors_url":"https://api.github.com/repos/scrapinghub/splash/contributors","subscribers_url":"https://api.github.com/repos/scrapinghub/splash/subscribers","subscription_url":"https://api.github.com/repos/scrapinghub/splash/subscription","commits_url":"https://api.github.com/repos/scrapinghub/splash/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapinghub/splash/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapinghub/splash/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapinghub/splash/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapinghub/splash/contents/{+path}","compare_url":"https://api.github.com/repos/scrapinghub/splash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapinghub/splash/merges","archive_url":"https://api.github.com/repos/scrapinghub/splash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapinghub/splash/downloads","issues_url":"https://api.github.com/repos/scrapinghub/splash/issues{/number}","pulls_url":"https://api.github.com/repos/scrapinghub/splash/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapinghub/splash/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapinghub/splash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapinghub/splash/labels{/name}","releases_url":"https://api.github.com/repos/scrapinghub/splash/releases{/id}","deployments_url":"https://api.github.com/repos/scrapinghub/splash/deployments","created_at":"2013-05-20T21:20:33Z","updated_at":"2016-04-26T13:23:24Z","pushed_at":"2016-04-26T12:02:34Z","git_url":"git://github.com/scrapinghub/splash.git","ssh_url":"git@github.com:scrapinghub/splash.git","clone_url":"https://github.com/scrapinghub/splash.git","svn_url":"https://github.com/scrapinghub/splash","homepage":"","size":3928,"stargazers_count":694,"watchers_count":694,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":78,"forks":118,"open_issues":78,"watchers":694,"default_branch":"master"}},"base":{"label":"scrapinghub:master","ref":"master","sha":"03a6daa868219bf5ea619062e5ff067edc15b956","user":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"repo":{"id":10182205,"name":"splash","full_name":"scrapinghub/splash","owner":{"login":"scrapinghub","id":699596,"avatar_url":"https://avatars.githubusercontent.com/u/699596?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapinghub","html_url":"https://github.com/scrapinghub","followers_url":"https://api.github.com/users/scrapinghub/followers","following_url":"https://api.github.com/users/scrapinghub/following{/other_user}","gists_url":"https://api.github.com/users/scrapinghub/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapinghub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapinghub/subscriptions","organizations_url":"https://api.github.com/users/scrapinghub/orgs","repos_url":"https://api.github.com/users/scrapinghub/repos","events_url":"https://api.github.com/users/scrapinghub/events{/privacy}","received_events_url":"https://api.github.com/users/scrapinghub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapinghub/splash","description":"Lightweight, scriptable browser as a service with an HTTP API","fork":false,"url":"https://api.github.com/repos/scrapinghub/splash","forks_url":"https://api.github.com/repos/scrapinghub/splash/forks","keys_url":"https://api.github.com/repos/scrapinghub/splash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapinghub/splash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapinghub/splash/teams","hooks_url":"https://api.github.com/repos/scrapinghub/splash/hooks","issue_events_url":"https://api.github.com/repos/scrapinghub/splash/issues/events{/number}","events_url":"https://api.github.com/repos/scrapinghub/splash/events","assignees_url":"https://api.github.com/repos/scrapinghub/splash/assignees{/user}","branches_url":"https://api.github.com/repos/scrapinghub/splash/branches{/branch}","tags_url":"https://api.github.com/repos/scrapinghub/splash/tags","blobs_url":"https://api.github.com/repos/scrapinghub/splash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapinghub/splash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapinghub/splash/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapinghub/splash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapinghub/splash/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapinghub/splash/languages","stargazers_url":"https://api.github.com/repos/scrapinghub/splash/stargazers","contributors_url":"https://api.github.com/repos/scrapinghub/splash/contributors","subscribers_url":"https://api.github.com/repos/scrapinghub/splash/subscribers","subscription_url":"https://api.github.com/repos/scrapinghub/splash/subscription","commits_url":"https://api.github.com/repos/scrapinghub/splash/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapinghub/splash/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapinghub/splash/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapinghub/splash/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrapinghub/splash/contents/{+path}","compare_url":"https://api.github.com/repos/scrapinghub/splash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapinghub/splash/merges","archive_url":"https://api.github.com/repos/scrapinghub/splash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapinghub/splash/downloads","issues_url":"https://api.github.com/repos/scrapinghub/splash/issues{/number}","pulls_url":"https://api.github.com/repos/scrapinghub/splash/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapinghub/splash/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapinghub/splash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapinghub/splash/labels{/name}","releases_url":"https://api.github.com/repos/scrapinghub/splash/releases{/id}","deployments_url":"https://api.github.com/repos/scrapinghub/splash/deployments","created_at":"2013-05-20T21:20:33Z","updated_at":"2016-04-26T13:23:24Z","pushed_at":"2016-04-26T12:02:34Z","git_url":"git://github.com/scrapinghub/splash.git","ssh_url":"git@github.com:scrapinghub/splash.git","clone_url":"https://github.com/scrapinghub/splash.git","svn_url":"https://github.com/scrapinghub/splash","homepage":"","size":3928,"stargazers_count":694,"watchers_count":694,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":78,"forks":118,"open_issues":78,"watchers":694,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/447"},"html":{"href":"https://github.com/scrapinghub/splash/pull/447"},"issue":{"href":"https://api.github.com/repos/scrapinghub/splash/issues/447"},"comments":{"href":"https://api.github.com/repos/scrapinghub/splash/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrapinghub/splash/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/scrapinghub/splash/statuses/f0a4e55650fa3db59c65fdcd857d34c7bd3442b6"}}}}