Best Python code snippet using robotframework-pageobjects_python
twitter.py
Source:twitter.py  
...16    def sign_up(self):17        """Crea una cuenta de twitter con los datos dados. No guarda nada en BD, sólo entra en twitter y lo registra"""18        def check_email():19            while True:20                if self.check_visibility('.prompt.email .sidetip .checking.active'):21                    self.delay.seconds(0.5)22                elif self.check_visibility('.prompt.email .sidetip .error.active'):23                    raise EmailExistsOnTwitter(self.user.email)24                elif self.check_visibility('.prompt.email .sidetip .ok.active'):25                    break26        def change_username():27            alternatives = self.get_css_elements('.suggestions button')28            if alternatives:29                # puede que alguna alternativa no se vea, asà que si va mal el click cogemos otra hasta que vaya30                while True:31                    alt = random.choice(alternatives)32                    try:33                        self.click(alt)34                        self.user.username = alt.text35                        self.user.save()36                        break37                    except MoveTargetOutOfBoundsException:38                        pass39            else:40                self.user.username = generate_random_username(self.user.real_name)41                self.fill_input_text('#username', self.user.username)42        def check_username():43            while True:44                # CHECKING..45                if self.check_visibility('.select-username .sidetip .checking.active'):46                    self.delay.seconds(0.5)47                # ERROR48                elif self.check_visibility('.select-username .sidetip .error.active'):49                    change_username()50                # USERNAME OK51                elif self.check_visibility('.select-username .sidetip .ok.active'):52                    break53        def check_phone_verification():54            if check_condition(lambda: 'phone_number' in self.browser.current_url, timeout=20):55                raise BotMustVerifyPhone(self)56        try:57            self.logger.info('Signing up on twitter..')58            self.go_to(settings.URLS['twitter_reg'])59            self.wait_to_page_readystate()60            # hay dos maneras de rellenar el formulario de registro en twitter, según como nos aparezca la interfaz61            if self.check_visibility('#next_button'):62                self.fill_input_text('#email', self.user.email)63                check_email()64                self.click('#next_button')65                self.fill_input_text('#full-name', self.user.real_name)66                self.click('#submit_button')67                check_phone_verification()68                self.fill_input_text('#password', self.user.password_twitter)69                self.click('#submit_button')70                self.fill_input_text('#username', self.user.username)71                check_username()72                self.click('#submit_button')73            elif self.check_visibility('#full-name'):74                self.fill_input_text('#full-name', self.user.real_name)75                self.fill_input_text('#email', self.user.email)76                check_email()77                if not self.check_visibility('#password'):78                    if self.check_visibility('#username'):79                        self.fill_input_text('#username', self.user.username)80                        check_username()81                        checkbox_css1 = 'div.prompt:nth-child(4) > label:nth-child(1) > input:nth-child(1)'82                        checkbox_css2 = 'input[name="user[use_cookie_personalization]"]'83                        self.try_to_click(checkbox_css1, checkbox_css2)84                        self.click('#submit_button')85                        self.delay.seconds(4)86                        self.fill_input_text('#password', self.user.password_twitter)87                        self.click('#submit_button')88                    elif self.check_visibility('#password'):89                        self.fill_input_text('#password', self.user.password_twitter)90                        self.try_to_click('#submit_button')91                        self.fill_input_text('#username', self.user.username)92                        check_username()93                        self.try_to_click('input[name="submit_button"]', 'input#submit_button')94                        # si sale un cartelito "that's you" picamos en alguna de las sugerencias de username95                        if self.check_visibility('#message-drawer .message-text'):96                            self.click('#skip_link')97                    else:98                        self.try_to_click('input[name="submit_button"]', 'input#submit_button')99                        self.delay.seconds(8)100                        self.wait_to_page_readystate()101                        if self.check_visibility('#password'):102                            self.fill_input_text('#password', self.user.password_twitter)103                            self.try_to_click('input[name="submit_button"]', 'input#submit_button')104                            self.delay.seconds(8)105                            self.wait_to_page_readystate()106                            self.fill_input_text('#username', self.user.username)107                            check_username()108                            self.try_to_click('input[name="submit_button"]', 'input#submit_button')109                            if self.check_visibility('#message-drawer .message-text'):110                                self.click('#skip_link')111                else:112                    self.fill_input_text('#password', self.user.password_twitter)113                    if self.check_visibility('#username'):114                        self.fill_input_text('#username', self.user.username)115                        check_username()116                        self.try_to_click('input[name="submit_button"]', 'input#submit_button')117                    else:118                        self.try_to_click('input[name="submit_button"]', 'input#submit_button')119                        self.delay.seconds(10)120                        check_phone_verification()121                        self.fill_input_text('#username', self.user.username)122                        check_username()123                        self.try_to_click('input[name="submit_button"]', 'input#submit_button')124                        # si sale un cartelito "that's you" picamos en alguna de las sugerencias de username125                        if self.check_visibility('#message-drawer .message-text'):126                            self.click('#skip_link')127            self.delay.seconds(10)128            # le damos al botón 'next' que sale en la bienvenida (si lo hay)129            self.try_to_click('a[href="/welcome/recommendations"]')130            self.wait_to_page_readystate()131            self.delay.seconds(7)132            # si pide teléfono133            check_phone_verification()134            wait_condition(lambda: 'congratulations' in self.browser.current_url or135                                   'welcome' in self.browser.current_url or136                                   'start' in self.browser.current_url)137            self.take_screenshot('twitter_registered_ok', force_take=True)138            # finalmente lo ponemos como registrado en twitter139            self.user.twitter_registered_ok = True140            self.user.date = utc_now()141            self.user.save()142            self.logger.info('Twitter account registered successfully')143        except (PageLoadError,144                EmailExistsOnTwitter,145                BotMustVerifyPhone):146            raise SignupTwitterError147        except Exception as e:148            self.take_screenshot('twitter_registered_fail', force_take=True)149            self.logger.exception('Error registering twitter account')150            raise e151    def is_logged_in(self):152        return self.check_visibility('#global-new-tweet-button')153    def login(self):154        """Hace todo el proceso de entrar en twitter y loguearse si fuera necesario por no tener las cookies guardadas"""155        try:156            self.go_to(settings.URLS['twitter_login'])157            self.wait_to_page_readystate()158            # para ver si ya estamos logueados o no159            if not self.is_logged_in():160                if self.check_visibility('#signin-email'):161                    self.fill_input_text('#signin-email', self.user.username)162                    self.fill_input_text('#signin-password', self.user.password_twitter)163                    self.try_to_click('.front-signin button', 'input.submit')164                else:165                    self.click('#signin-link')166                    self.delay.seconds(3)167                    self.fill_input_text('#signin-dropdown input[type="text"]', self.user.username)168                    self.fill_input_text('#signin-dropdown input[type="password"]', self.user.password_twitter)169                    self.click('#signin-dropdown button[type="submit"]')170            self.wait_to_page_readystate()171            self.check_account_exists()172            # si no estaba en BD como registrado en twitter se marca que sÃ173            if not self.user.twitter_registered_ok:174                self.user.twitter_registered_ok = True175                self.user.save()176            self.clear_local_storage()177            self.check_account_suspended()178        except (TwitterEmailNotConfirmed,179                TwitterAccountDead,180                TwitterAccountSuspended) as e:181            self.take_screenshot('twitter_email_not_confirmed_after_login', force_take=True)182            self.user.clear_all_not_sent_ok_tweets()183            raise e184        except Exception as e:185            self.logger.exception('Login on twitter error')186            self.take_screenshot('login_failure', force_take=True)187            raise e188    def lift_suspension(self):189        # intentamos levantar suspensión190        def submit_unsuspension(attempt):191            if attempt == 5:192                if settings.MARK_BOT_AS_DEATH_AFTER_TRYING_LIFTING_SUSPENSION:193                    self.logger.warning('Exceeded 5 attemps to lift suspension.')194                    raise TwitterAccountDead(self.user)195                else:196                    raise TwitterAccountSuspendedAfterTryingUnsuspend(self)197            else:198                self.logger.info('Lifting twitter account suspension (attempt %i)..' % attempt)199                cr.resolve_captcha(200                    self.get_css_element('#recaptcha_challenge_image'),201                    self.get_css_element('#recaptcha_response_field')202                )203                self.try_to_click('#checkbox_discontinue')204                self.try_to_click('#checkbox_permanent')205                self.click('#suspended_help_submit')206                self.delay.seconds(5)207                if self.check_visibility('form.t1-form .error-occurred'):208                    cr.report_wrong_captcha()209                    submit_unsuspension(attempt+1)210                else:211                    # si la suspensión se levantó bien..212                    self.user.unmark_as_suspended()213        cr = DeathByCaptchaResolver(self)214        self.click(self.get_css_element('#account-suspended a'))215        self.wait_to_page_readystate()216        try:217            if self.check_visibility('#suspended_help_submit'):218                submit_unsuspension(attempt=0)219            else:220                raise TwitterAccountDead(self.user)221        except TwitterAccountDead as e:222            raise e223        except Exception as e:224            self.logger.exception('error lifting suspension')225            raise e226    def check_account_suspended(self):227        """Una vez logueado miramos si fue suspendida la cuenta"""228        bot_is_suspended = lambda: self.get_css_element('#account-suspended') and \229                                   self.get_css_element('#account-suspended').is_displayed()230        if check_condition(bot_is_suspended):231            if 'confirm your email' in self.get_css_element('#account-suspended').text:232                self.click('#account-suspended a')233                self.delay.seconds(4)234                raise TwitterEmailNotConfirmed(self)235            else:236                if not self.user.twitter_confirmed_email_ok:237                    self.user.twitter_confirmed_email_ok = True238                    self.user.save()239                if not self.user.is_suspended:240                    self.user.mark_as_suspended()241                self.lift_suspension()242        elif self.check_visibility('.resend-confirmation-email-link'):243            self.click('.resend-confirmation-email-link')244            self.delay.seconds(4)245            raise TwitterEmailNotConfirmed(self)246        else:247            if self.user.is_suspended:248                self.user.unmark_as_suspended()249            # si no estaba en BD como email confirmado también se marca250            if not self.user.twitter_confirmed_email_ok:251                self.user.twitter_confirmed_email_ok = True252                self.user.save()253    def check_account_exists(self):254        "Mira si tras intentar loguearse el usuario existe o no en twitter"255        if 'error' in self.browser.current_url:256            raise TwitterBotDontExistsOnTwitterException(self)257    def twitter_page_is_loaded_on_new_window(self):258        """mira si se cargó por completo la página en la ventana nueva que se abre al pinchar en el enlace259        del email de confirmación enviado por twitter"""260        is_twitter_confirm_window_opened = len(self.browser.window_handles) == self.num_prev_opened_windows + 1261        if is_twitter_confirm_window_opened:262            self.switch_to_window(-1)263            return self.browser.execute_script("return document.readyState;") == 'complete'264        else:265            return False266    def set_profile(self):267        """precondición: estar logueado y en la home"""268        def set_avatar():269            self.logger.info('Setting twitter avatar..')270            avatar_path = os.path.join(settings.AVATARS_DIR, '%s.png' % self.user.username)271            try:272                self.download_pic_from_google()273                try:274                    self.click('.ProfileAvatar a')275                    if not self.check_visibility('#photo-choose-existing'):276                        self.click('button.ProfileAvatarEditing-button')277                except:278                    self.click('button.ProfileAvatarEditing-button')279                self.get_css_element('#photo-choose-existing input[type="file"]').send_keys(avatar_path)280                self.click('#profile_image_upload_dialog-dialog button.profile-image-save')281                # eliminamos el archivo que habÃamos guardado para el avatar282                os.remove(avatar_path)283                return True284            except ErrorDownloadingPicFromGoogle:285                raise ErrorSettingAvatar(self)286            except Exception:287                self.logger.exception(ErrorSettingAvatar.msg)288                self.take_screenshot('set_avatar_failure', force_take=True)289                return False...hotmail.py
Source:hotmail.py  
...16                self.get_css_element('#iHipHolder input.hipInputText')17            )18        def fix_username(errors=False):19            # username20            if self.check_visibility('#iPwd'):21                self.click('#iPwd')22            if self.check_visibility('#iMembernameLiveError', timeout=5) or \23                    self.check_visibility('#iLiveMessageError'):24                self.take_screenshot('form_wrong_username')25                errors = True26                if self.check_visibility('#sug'):27                    suggestions = self.get_css_elements('#sug #mysugs div a', timeout=10)28                    chosen_suggestion = random.choice(suggestions)29                    self.user.email = chosen_suggestion.text30                    self.click(chosen_suggestion)31                else:32                    self.user.email = generate_random_username(self.user.real_name) + '@hotmail.com'33                    self.fill_input_text('#imembernamelive', self.user.get_email_username())34                    self.delay.seconds(5)35                fix_username(errors)36            else:37                pass38        def submit_form():39            """Comprobamos que todo bien y enviamos registro. Si no sale bien corregimos y volvemos a enviar,40            y asà sucesivamente"""41            def check_form():42                errors = False43                self.take_screenshot('checking_form_after_submit')44                self.delay.seconds(7)  # todo: comprobar después de captcha45                fix_username(errors)46                # error en passwords47                if self.check_visibility('#iPwdError'):48                    errors = True49                    self.user.password_email = generate_random_string()50                    self.fill_input_text('#iPwd', self.user.password_email)51                    self.fill_input_text('#iRetypePwd', self.user.password_email)52                # error en captcha53                captcha_errors = self.get_css_elements('.hipErrorText')54                captcha_error_visible = captcha_errors and \55                                        (56                                            self.check_visibility(captcha_errors[1], timeout=5) or57                                            self.check_visibility(captcha_errors[2], timeout=5)58                                        )59                if captcha_error_visible:60                    self.click('#iHipHolder input.hipInputText')61                    self.take_screenshot('form_wrong_captcha', force_take=True)62                    errors = True63                    #captcha_resolver.report_wrong_captcha()64                    resolve_captcha()65                return errors66            self.click('#createbuttons input')67            errors = check_form()68            if errors:69                submit_form()70        def fill_form():71            self.click('#iliveswitch')72            self.fill_input_text('#iFirstName', self.user.real_name.split(' ')[0])73            self.fill_input_text('#iLastName', self.user.real_name.split(' ')[1])74            # cambiamos de @outlok a hotmail75            self.click('#idomain')76            self.send_special_key(Keys.ARROW_DOWN)77            self.send_special_key(Keys.ENTER)78            # username (lo que va antes del @)79            self.fill_input_text('#imembernamelive', self.user.get_email_username())80            # provocamos click en pwd para que salte lo de apañar el nombre de usuario81            fix_username()82            # una vez corregido el nombre de usuario seguimos rellenando el password y demás..83            self.fill_input_text('#iPwd', self.user.password_email)84            self.fill_input_text('#iRetypePwd', self.user.password_email)85            self.fill_input_text('#iZipCode', self.get_usa_zip_code())86            # FECHA DE NACIMIENTO87            self.click('#iBirthMonth')88            for _ in range(0, self.user.birth_date.month):89                self.send_special_key(Keys.ARROW_DOWN)90            self.delay.seconds(1)91            self.fill_input_text('#iBirthDay', self.user.birth_date.day)92            self.delay.seconds(1)93            self.fill_input_text('#iBirthYear', self.user.birth_date.year)94            # SEXO95            self.click('#iGender')96            for _ in range(0, self.user.gender+1):97                self.send_special_key(Keys.ARROW_DOWN)98            self.fill_input_text('#iAltEmail', generate_random_username() + '@gmail.com')99            resolve_captcha()100            self.click('#iOptinEmail')101        self.logger.info('Signing up %s..' % self.user.email)102        self.go_to(settings.URLS['hotmail_reg'])103        captcha_resolver = DeathByCaptchaResolver(self)104        self.wait_visibility_of_css_element('#iliveswitch', timeout=10)105        fill_form()106        self.delay.seconds(5)107        submit_form()108        try:109            wait_condition(lambda: 'Microsoft account | Home'.lower() in self.browser.title.lower())110        except Exception:111            raise HotmailAccountNotCreated(self)112    def check_account_suspended(self):113        suspended = lambda: 'unblock' in self.browser.title.lower() or \114                            'overprotective' in self.browser.title.lower()115        suspended = check_condition(suspended)116        if suspended and self.check_invisibility('#skipLink'):117            raise EmailAccountSuspended(self)118    def login(self):119        def submit_form(attempts=0):120            def check_form():121                errors = False122                if self.check_visibility('#idTd_Tile_ErrorMsg_Login', timeout=10):123                    errors = True124                    if self.check_visibility('#idTd_HIP_HIPControl'):125                        # si hay captcha que rellenar..126                        cr = DeathByCaptchaResolver(self)127                        cr.resolve_captcha('#idTd_HIP_HIPControl img', '#idTd_HIP_HIPControl input')128                        self.fill_input_text('input[name=passwd]', self.user.password_email)129                    else:130                        # si no hay captcha entonces lanzamos excepción diciendo que el email no existe como registrado131                        raise EmailAccountNotFound(self)132                return errors133            if attempts > 1:134                # self.user.email_registered_ok = False135                # self.user.save()136                self.take_screenshot('too_many_attempts')137                self.close_browser()138                raise Exception('too many attempts to login %s' % self.user.email)139            self.click('input[type="submit"]')140            errors = check_form()141            if errors:142                submit_form(attempts+1)143        try:144            self.go_to(settings.URLS['hotmail_login'])145            self.wait_to_page_readystate()146            self.delay.seconds(5)147            if self.check_visibility('#idDiv_PWD_UsernameTb'):148                self.fill_input_text('#idDiv_PWD_UsernameTb input', self.user.email)149                self.fill_input_text('#idDiv_PWD_PasswordTb input', self.user.password_email)150                self.click('#idChkBx_PWD_KMSI0Pwd')  # para mantener la sesión si cierro navegador151                submit_form()152                self.wait_to_page_readystate()153            # a partir de aquà se supone que no deberÃa aparecer más en la página de sign in154            if 'sign in' in self.browser.title.lower():155                raise PageNotRetrievedOkByWebdriver(self)156            else:157                self.delay.seconds(10)158                self.wait_to_page_readystate()159                self.clear_local_storage()160                self._quit_inbox_shit()161                self.check_account_suspended()162                self.logger.debug('Logged in hotmail ok')163                # por si no se habÃa marcado en BD164                if not self.user.email_registered_ok:165                    self.user.email_registered_ok = True166                    self.user.save()167        except (EmailAccountNotFound,168                EmailAccountSuspended,169                PageLoadError) as e:170            raise e171        except Exception as e:172            self.logger.exception('Error on hotmail login')173            raise e174    def _quit_inbox_shit(self):175        # en el caso de aparecer esto tras el login le damos al enlace que aparece en la página176        if check_condition(lambda: 'BrowserSupport' in self.browser.current_url):177            self.take_screenshot('continue_to_your_inbox_link')178            self.click(self.browser.find_element_by_partial_link_text('continue to your inbox'))179        self.wait_to_page_readystate()180        self.try_to_click('#notificationContainer button', timeout=10)181    def confirm_tw_email(self):182        def skip_confirmation_shit():183            while True:184                if self.check_visibility('#idDiv_PWD_PasswordExample'):185                    self.fill_input_text('#idDiv_PWD_PasswordExample', self.user.password_email)186                    self.click('#idSIButton9')187                    self.wait_to_page_readystate()188                    self.try_to_click('#idBtn_SAOTCS_Cancel', 'a#iShowSkip')189                    self.wait_to_page_readystate()190                elif self.check_visibility('#idBtn_SAOTCS_Cancel'):191                    self.click('#idBtn_SAOTCS_Cancel')192                    self.wait_to_page_readystate()193                elif self.check_visibility('a#iShowSkip'):194                    self.click('a#iShowSkip')195                    self.wait_to_page_readystate()196                else:197                    self.wait_to_page_readystate()198                    self.take_screenshot('confirmation_shit_skipped')199                    break200        def get_email_title_on_inbox():201            return get_element(lambda: self.browser.find_element_by_partial_link_text('Confirm your'))202        def on_inbox_page():203            return self.check_visibility('div.c-MessageGroup')204        def click_on_inbox_msg():205            self.logger.debug('still on inbox, reclicking confirm email title..')206            self.click(get_email_title_on_inbox())207            # si no se ha clickeado bien y aparece el menu de notif208            if self.check_visibility('#notificationContainer div'):209                self.click('#notificationContainer')210                self.click(get_email_title_on_inbox())211            self.wait_to_page_readystate()212        def check_if_still_on_inbox():213            while on_inbox_page():214                click_on_inbox_msg()215                self.wait_to_page_readystate()216                self.delay.seconds(4)217        try:218            self.logger.info('Confirming twitter email %s..' % self.user.email)219            self.login()220            # vemos si realmente estamos en la bandeja de entrada221            # if not self.check_visibility('#pageInbox'):222            #     self.take_screenshot('not_really_on_inbox_page', force_take=True)223            #     raise Exception('%s is not really on inbox page after login' % self.user.email)224            # else:225            skip_confirmation_shit()226            self._quit_inbox_shit()227            self.take_screenshot('on_inbox_page')228            skip_confirmation_shit()229            self.try_to_click('#skipLink')230            inbox_msgs_css = '.InboxTable ul.InboxTableBody li'231            emails = self.get_css_elements(inbox_msgs_css)232            if not emails:233                skip_confirmation_shit()234                emails = self.get_css_elements(inbox_msgs_css)235            if emails:236                if len(emails) < 2:237                    self.logger.warning('No twitter email arrived, resending twitter email..')238                    raise TwitterEmailNotFound(self)239                else:240                    #twitter_email_title = get_element(lambda: self.browser.find_element_by_partial_link_text('Confirm'))241                    self.delay.seconds(10)242                    skip_confirmation_shit()243                    # sólo clickeamos si el mensaje más reciente no fue leÃdo244                    emails = self.get_css_elements(inbox_msgs_css)245                    was_read = 'mlUnrd' not in emails[0].get_attribute('class')246                    if was_read:247                        raise NotNewTwitterEmailFound(self)248                    else:249                        twitter_email_title = get_email_title_on_inbox()250                        self.click(twitter_email_title)251                        check_if_still_on_inbox()252                        self.delay.seconds(2)253                        # si sale confirm otra vez y se vuelve a ir a la inbox..254                        skip_confirmation_shit()255                        check_if_still_on_inbox()256                        self.delay.seconds(4)257                        confirm_btn = get_element(lambda: self.browser.find_element_by_partial_link_text('Confirm now'))258                        if confirm_btn:259                            self.click(confirm_btn)260                        else:261                            self.try_to_click('.ecxbutton_link', '.ecxmedia_main > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(4) > td:nth-child(1) > a:nth-child(2)')262                        self.delay.seconds(3)263                        self.switch_to_window(-1)264                        self.wait_to_page_readystate()265                        self.delay.seconds(3)266                        # si aparece como suspendido lo tratamos más adelante267                        if 'suspended' in self.browser.title.lower():268                            raise TwitterAccountSuspended(self.user)269                        # si no cargó bien la página de twitter de pulsar el enlace, aunque confirme igualmente,270                        # lo anotamos en el log271                        elif 'about:blank' in self.browser.current_url:272                            self.logger.warning('about:blank on twitter page after clicking confirmation link')273                            # raise AboutBlankPage(self)274                        # si ha ido ok pero nos pide meter usuario y contraseña275                        elif not self.check_visibility('#global-new-tweet-button'):276                            self.send_keys(self.user.username)277                            self.send_special_key(Keys.TAB)278                            self.send_keys(self.user.password_twitter)279                            self.send_special_key(Keys.ENTER)280                            self.delay.seconds(7)281            else:282                raise NotInEmailInbox(self)283        except (TwitterEmailNotFound,284                TwitterAccountSuspended,285                PageLoadError,286                NotNewTwitterEmailFound,287                NotInEmailInbox):...gmail.py
Source:gmail.py  
...10#     def sign_up(self):11#         def submit_form():12#             """Comprobamos que todo bien y enviamos registro. Si no sale bien corregimos y volvemos a enviar,13#             y asà sucesivamente"""14#             if self.check_visibility('#GmailAddress.form-error'):15#                 suggestions = self.browser.find_elements_by_css_selector('#username-suggestions a')16#                 if suggestions:17#                     click(random.choice(suggestions))18#                 else:19#                     self.user.email = generate_random_username(self.user.real_name) + '@gmail.com'20#                     send_keys(self.browser.find_element_by_id('GmailAddress'), self.user.email.split('@')[0])21#22#23#             if self.check_visibility('#errormsg_0_signupcaptcha'):24#                 self.report_wrong_captcha()25#                 self.resolve_captcha(26#                     self.browser.find_element_by_css_selector('#recaptcha_image'),27#                     self.browser.find_element_by_css_selector('#recaptcha_response_field')28#                 )29#30#             if self.check_visibility('#Passwd.form-error'):31#                 send_keys(self.browser.find_element_by_id('Passwd'), self.user.password_email)32#                 send_keys(self.browser.find_element_by_id('PasswdAgain'), self.user.password_email)33#34#             click(self.browser.find_element_by_css_selector('#submitbutton'))35#36#             if self.check_visibility('#GmailAddress.form-error') or \37#                 self.check_visibility('#errormsg_0_signupcaptcha') or \38#                 self.check_visibility('#Passwd.form-error'):39#                 submit_form()40#41#         self.browser.get(settings.URLS['gmail_reg'])42#         first_name, last_name = self.user.real_name.split(' ')43#44#         send_keys(self.browser.find_element_by_id('FirstName'), first_name)45#         send_keys(self.browser.find_element_by_id('LastName'), last_name)46#         send_keys(self.browser.find_element_by_id('GmailAddress'), self.user.email.split('@')[0])47#         send_keys(self.browser.find_element_by_id('Passwd'), self.user.password_email)48#         send_keys(self.browser.find_element_by_id('PasswdAgain'), self.user.password_email)49#50#         # cumpleaños51#         # dia52#         send_keys(self.browser.find_element_by_id('BirthDay'), str(self.user.birth_date.day))...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
