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