| 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 def LoginGoogleAccount(action_runner, credential, | 7 def LoginAccount( |
| 8 credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): | 8 action_runner, credential, |
| 9 """Logs in into Google account. | 9 credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): |
| 10 """Logs in into mobile Facebook account. |
| 10 | 11 |
| 11 This function navigates the tab into Google's login page and logs in a user | 12 This function navigates the tab into Facebook's login page and logs in a user |
| 12 using credentials in |credential| part of the |credentials_path| file. | 13 using credentials in |credential| part of the |credentials_path| file. |
| 13 | 14 |
| 14 Args: | 15 Args: |
| 15 action_runner: Action runner responsible for running actions on the page. | 16 action_runner: Action runner responsible for running actions on the page. |
| 16 credential: The credential to retrieve from the credentials file | 17 credential: The credential to retrieve from the credentials file |
| 17 (type string). | 18 (type string). |
| 18 credentials_path: The string that specifies the path to credential file. | 19 credentials_path: The string that specifies the path to credential file. |
| 19 | 20 |
| 20 Raises: | 21 Raises: |
| 21 exceptions.Error: See ExecuteJavaScript() | 22 exceptions.Error: See ExecuteJavaScript() |
| 22 for a detailed list of possible exceptions. | 23 for a detailed list of possible exceptions. |
| 23 """ | 24 """ |
| 24 account_name, password = login_utils.GetAccountNameAndPassword( | 25 account_name, password = login_utils.GetAccountNameAndPassword( |
| 25 credential, credentials_path=credentials_path) | 26 credential, credentials_path=credentials_path) |
| 26 | 27 |
| 27 action_runner.Navigate( | 28 action_runner.Navigate( |
| 28 'https://accounts.google.com/ServiceLogin?continue=' | 29 'https://m.facebook.com/login?continue=https%3A%2F%2Fm.facebook.com') |
| 29 'https%3A%2F%2Faccounts.google.com%2FManageAccount') | 30 login_utils.InputWithSelector(action_runner, account_name, '[name=email]') |
| 30 login_utils.InputForm(action_runner, account_name, input_id='Email', | 31 login_utils.InputWithSelector(action_runner, password, '[name=pass]') |
| 31 form_id='gaia_firstform') | 32 action_runner.ClickElement(selector='[name=login]') |
| 32 action_runner.ClickElement(selector='#gaia_firstform #next') | 33 action_runner.WaitForElement(text='OK') |
| 33 login_utils.InputForm(action_runner, password, input_id='Passwd') | 34 action_runner.ClickElement(text='OK') |
| 34 action_runner.ClickElement(selector='#signIn') | 35 action_runner.WaitForNavigate() |
| 35 action_runner.WaitForElement(text='My Account') | |
| OLD | NEW |