Chromium Code Reviews| 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 LoginWithMobileSite( | 7 def LoginWithMobileSite( |
| 8 action_runner, credential, | 8 action_runner, credential, |
| 9 credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): | 9 credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): |
| 10 """Logs in into mobile Facebook account. | 10 """Logs in into mobile Facebook account. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 credential, credentials_path=credentials_path) | 26 credential, credentials_path=credentials_path) |
| 27 | 27 |
| 28 action_runner.Navigate( | 28 action_runner.Navigate( |
| 29 'https://m.facebook.com/login?continue=https%3A%2F%2Fm.facebook.com') | 29 'https://m.facebook.com/login?continue=https%3A%2F%2Fm.facebook.com') |
| 30 login_utils.InputWithSelector(action_runner, account_name, '[name=email]') | 30 login_utils.InputWithSelector(action_runner, account_name, '[name=email]') |
| 31 login_utils.InputWithSelector(action_runner, password, '[name=pass]') | 31 login_utils.InputWithSelector(action_runner, password, '[name=pass]') |
| 32 action_runner.ClickElement(selector='[name=login]') | 32 action_runner.ClickElement(selector='[name=login]') |
| 33 action_runner.WaitForElement(text='OK') | 33 action_runner.WaitForElement(text='OK') |
| 34 action_runner.ClickElement(text='OK') | 34 action_runner.ClickElement(text='OK') |
| 35 action_runner.WaitForNavigate() | 35 action_runner.WaitForNavigate() |
| 36 | |
| 37 | |
| 38 def LoginWithDesktopSite( | |
| 39 action_runner, credential, | |
| 40 credentials_path=login_utils.DEFAULT_CREDENTIAL_PATH): | |
| 41 """Logs in into desktop Facebook account. | |
| 42 | |
| 43 This function navigates the tab into Facebook's login page and logs in a user | |
| 44 using credentials in |credential| part of the |credentials_path| file. | |
| 45 | |
| 46 Args: | |
| 47 action_runner: Action runner responsible for running actions on the page. | |
| 48 credential: The credential to retrieve from the credentials file | |
| 49 (type string). | |
| 50 credentials_path: The string that specifies the path to credential file. | |
| 51 | |
| 52 Raises: | |
| 53 exceptions.Error: See ExecuteJavaScript() | |
| 54 for a detailed list of possible exceptions. | |
| 55 """ | |
| 56 account_name, password = login_utils.GetAccountNameAndPassword( | |
| 57 credential, credentials_path=credentials_path) | |
| 58 | |
| 59 # Currently we use the mobile login page also on Desktop because the | |
|
charliea (OOO until 10-5)
2016/07/29 20:10:01
s/Desktop/desktop
charliea (OOO until 10-5)
2016/07/29 20:10:01
s/"we use the mobile login page also on Desktop"/"
| |
| 60 # Desktop version requires enabled cookies and rejects the login. | |
|
petrcermak
2016/08/01 11:22:30
In that case, why the code duplication? You can ju
Hannes Payer (out of office)
2016/08/04 11:38:01
Right on. Done.
| |
| 61 action_runner.Navigate( | |
| 62 'https://m.facebook.com/login?continue=https%3A%2F%2Fm.facebook.com') | |
| 63 login_utils.InputWithSelector(action_runner, account_name, '[name=email]') | |
| 64 login_utils.InputWithSelector(action_runner, password, '[name=pass]') | |
| 65 action_runner.ClickElement(selector='[name=login]') | |
| 66 action_runner.WaitForElement(text='OK') | |
| 67 action_runner.ClickElement(text='OK') | |
| 68 action_runner.WaitForNavigate() | |
| OLD | NEW |