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 from page_sets.login_helpers import login_utils | 4 from page_sets.login_helpers import login_utils |
5 | 5 |
6 | 6 |
7 # JavaScript conditions which are true when the email and password inputs on | 7 # JavaScript conditions which are true when the email and password inputs on |
8 # the Google Login page are visible respectively. | 8 # the Google Login page are visible respectively. |
9 _EMAIL_INPUT_VISIBLE_CONDITION = ( | 9 _EMAIL_INPUT_VISIBLE_CONDITION = ( |
10 'document.querySelector("#Email:not(.hidden)") !== null') | 10 'document.querySelector("#Email:not(.hidden)") !== null') |
(...skipping 25 matching lines...) Expand all Loading... |
36 for a detailed list of possible exceptions. | 36 for a detailed list of possible exceptions. |
37 """ | 37 """ |
38 account_name, password = login_utils.GetAccountNameAndPassword( | 38 account_name, password = login_utils.GetAccountNameAndPassword( |
39 credential, credentials_path=credentials_path) | 39 credential, credentials_path=credentials_path) |
40 | 40 |
41 action_runner.Navigate( | 41 action_runner.Navigate( |
42 'https://accounts.google.com/ServiceLogin?continue=' | 42 'https://accounts.google.com/ServiceLogin?continue=' |
43 'https%3A%2F%2Faccounts.google.com%2FManageAccount') | 43 'https%3A%2F%2Faccounts.google.com%2FManageAccount') |
44 | 44 |
45 # Wait until either the email or password input is visible. | 45 # Wait until either the email or password input is visible. |
46 action_runner.WaitForJavaScriptCondition2('{{ @a }} || {{ @b }}', | 46 action_runner.WaitForJavaScriptCondition('{{ @a }} || {{ @b }}', |
47 a=_EMAIL_INPUT_VISIBLE_CONDITION, b=_PASSWORD_INPUT_VISIBLE_CONDITION) | 47 a=_EMAIL_INPUT_VISIBLE_CONDITION, b=_PASSWORD_INPUT_VISIBLE_CONDITION) |
48 | 48 |
49 # If the email input is visible, this is the first Google login within the | 49 # If the email input is visible, this is the first Google login within the |
50 # browser session, so we must enter both email and password. Otherwise, only | 50 # browser session, so we must enter both email and password. Otherwise, only |
51 # password is required. | 51 # password is required. |
52 if action_runner.EvaluateJavaScript2(_EMAIL_INPUT_VISIBLE_CONDITION): | 52 if action_runner.EvaluateJavaScript(_EMAIL_INPUT_VISIBLE_CONDITION): |
53 login_utils.InputForm(action_runner, account_name, input_id='Email', | 53 login_utils.InputForm(action_runner, account_name, input_id='Email', |
54 form_id='gaia_firstform') | 54 form_id='gaia_firstform') |
55 action_runner.ClickElement(selector='#gaia_firstform #next') | 55 action_runner.ClickElement(selector='#gaia_firstform #next') |
56 | 56 |
57 login_utils.InputForm(action_runner, password, input_id='Passwd') | 57 login_utils.InputForm(action_runner, password, input_id='Passwd') |
58 action_runner.ClickElement(selector='#signIn') | 58 action_runner.ClickElement(selector='#signIn') |
59 action_runner.WaitForElement(text='My Account') | 59 action_runner.WaitForElement(text='My Account') |
OLD | NEW |