1# Copyright 2014 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 5from telemetry.internal.backends import form_based_credentials_backend 6 7 8class CodePenCredentialsBackend( 9 form_based_credentials_backend.FormBasedCredentialsBackend): 10 11 @property 12 def logged_in_javascript(self): 13 """Evaluates to true iff already logged in.""" 14 return 'document.querySelector(".login-area") === null' 15 16 @property 17 def credentials_type(self): 18 return 'codepen' 19 20 @property 21 def url(self): 22 return 'https://codepen.io/login' 23 24 @property 25 def login_form_id(self): 26 return 'login-login-form' 27 28 @property 29 def login_button_javascript(self): 30 return """ 31 LoginSettings.timeOnPageStartTime = 0; 32 document.getElementById("log-in-button").click(); 33 """ 34 35 @property 36 def login_input_id(self): 37 return 'login-email-field' 38 39 @property 40 def password_input_id(self): 41 return 'login-password-field_' 42