OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
| 5 import json |
5 import os | 6 import os |
6 import json | |
7 | |
8 | 7 |
9 DEFAULT_CREDENTIAL_PATH = os.path.join( | 8 DEFAULT_CREDENTIAL_PATH = os.path.join( |
10 os.path.dirname(__file__), os.path.pardir, 'data', 'credentials.json') | 9 os.path.dirname(__file__), os.path.pardir, 'data', 'credentials.json') |
11 | 10 |
12 | 11 |
13 def GetAccountNameAndPassword(credential, | 12 def GetAccountNameAndPassword(credential, |
14 credentials_path=DEFAULT_CREDENTIAL_PATH): | 13 credentials_path=DEFAULT_CREDENTIAL_PATH): |
15 """Returns username and password for |credential| in credentials_path file. | 14 """Returns username and password for |credential| in credentials_path file. |
16 | 15 |
17 Args: | 16 Args: |
(...skipping 30 matching lines...) Expand all Loading... |
48 if form_id and input_id: | 47 if form_id and input_id: |
49 element_selector = '#%s #%s' % (form_id, input_id) | 48 element_selector = '#%s #%s' % (form_id, input_id) |
50 elif input_id: | 49 elif input_id: |
51 element_selector = '#%s' % (input_id) | 50 element_selector = '#%s' % (input_id) |
52 else: | 51 else: |
53 raise ValueError("Input ID can not be None or empty.") | 52 raise ValueError("Input ID can not be None or empty.") |
54 action_runner.WaitForElement(selector=element_selector) | 53 action_runner.WaitForElement(selector=element_selector) |
55 action_runner.ExecuteJavaScript( | 54 action_runner.ExecuteJavaScript( |
56 'document.querySelector("%s").value = "%s";' % | 55 'document.querySelector("%s").value = "%s";' % |
57 (element_selector, input_text)) | 56 (element_selector, input_text)) |
OLD | NEW |