How to use verifyText method in fMBT

Best Python code snippet using fMBT_python

test_homepage_frontend.py

Source:test_homepage_frontend.py Github

copy

Full Screen

1# Generated by Selenium IDE2import pytest3import time4import json5from selenium import webdriver6from selenium.webdriver.common.by import By7from selenium.webdriver.common.action_chains import ActionChains8from selenium.webdriver.support import expected_conditions9from selenium.webdriver.support.wait import WebDriverWait10from selenium.webdriver.common.keys import Keys11from selenium.webdriver.common.desired_capabilities import DesiredCapabilities12class TestHomepage():13 def setup_method(self, method):14 self.driver = webdriver.Chrome()15 self.vars = {}16 17 def teardown_method(self, method):18 self.driver.quit()19 20 def test_homepage(self):21 # Test name: homepage22 # Step # | name | target | value | comment23 # 1 | open | /login | | 24 self.driver.get("http://sayless.azurewebsites.net/login")25 # 2 | setWindowSize | 1552x840 | | 26 self.driver.set_window_size(1552, 840)27 # 3 | click | id=emailInput | | 28 self.driver.find_element(By.ID, "emailInput").click()29 # 4 | type | id=emailInput | test@gmail.com | 30 self.driver.find_element(By.ID, "emailInput").send_keys("test@gmail.com")31 # 5 | type | id=passwordInput | password123 | 32 self.driver.find_element(By.ID, "passwordInput").send_keys("password123")33 # 6 | click | css=.submit | | 34 self.driver.find_element(By.CSS_SELECTOR, ".submit").click()35 WebDriverWait(self.driver, 30000).until(expected_conditions.presence_of_element_located((By.ID, "openchat")))36 # 7 | verifyText | css=a > h1 | SayLess | 37 assert self.driver.find_element(By.CSS_SELECTOR, "a > h1").text == "SayLess"38 # 8 | verifyText | id=startachat | Start a Chat | 39 assert self.driver.find_element(By.ID, "startachat").text == "Start a Chat"40 # 9 | selectFrame | index=1 | | 41 self.driver.switch_to.frame(1)42 # 10 | verifyText | id=note_username | test | 43 assert self.driver.find_element(By.ID, "note_username").text == "test"44 # 11 | verifyElementPresent | css=.avatar | | 45 elements = self.driver.find_elements(By.CSS_SELECTOR, ".avatar")46 assert len(elements) > 047 # 12 | verifyText | css=label | Bio: | 48 assert self.driver.find_element(By.CSS_SELECTOR, "label").text == "Bio:"49 # 13 | verifyText | id=bio_text | None | 50 assert self.driver.find_element(By.ID, "bio_text").text == "None"51 # 14 | selectFrame | relative=parent | | 52 self.driver.switch_to.default_content()53 # 15 | verifyText | id=45605af62c5c1a6ab3a3001757a610e218153f3ec3385bbbd613d995bee90966 | test2 | 54 assert self.driver.find_element(By.ID, "45605af62c5c1a6ab3a3001757a610e218153f3ec3385bbbd613d995bee90966").text == "test2"55 # 16 | verifyText | id=openchat | Open Chats | 56 assert self.driver.find_element(By.ID, "openchat").text == "Open Chats"57 # 17 | verifyText | id=suggestedchat | Suggested Users | 58 assert self.driver.find_element(By.ID, "suggestedchat").text == "Suggested Users"59 # 18 | click | id=45605af62c5c1a6ab3a3001757a610e218153f3ec3385bbbd613d995bee90966 | | 60 self.driver.find_element(By.ID, "45605af62c5c1a6ab3a3001757a610e218153f3ec3385bbbd613d995bee90966").click()61 # 19 | selectFrame | index=0 | | 62 self.driver.switch_to.frame(0)63 # 20 | click | css=button:nth-child(1) | | 64 self.driver.find_element(By.CSS_SELECTOR, "button:nth-child(1)").click()65 # 21 | selectFrame | relative=parent | | 66 self.driver.switch_to.default_content()67 # 22 | selectFrame | index=1 | | 68 self.driver.switch_to.frame(1)69 # 23 | verifyText | id=note_username | test2 | 70 assert self.driver.find_element(By.ID, "note_username").text == "test2"71 # 24 | verifyElementPresent | css=.avatar | | 72 elements = self.driver.find_elements(By.CSS_SELECTOR, ".avatar")73 assert len(elements) > 074 # 25 | selectFrame | relative=parent | | 75 self.driver.switch_to.default_content()76 # 26 | selectFrame | index=0 | | 77 self.driver.switch_to.frame(0)78 # 27 | verifyText | css=button:nth-child(1) | test2 | 79 assert self.driver.find_element(By.CSS_SELECTOR, "button:nth-child(1)").text == "test2"80 # 28 | selectFrame | relative=parent | | 81 self.driver.switch_to.default_content()82 # 29 | click | css=.fa-home | | 83 self.driver.find_element(By.CSS_SELECTOR, ".fa-home").click()84 # 30 | mouseOver | css=a > h1 | | 85 element = self.driver.find_element(By.CSS_SELECTOR, "a > h1")86 actions = ActionChains(self.driver)87 actions.move_to_element(element).perform()88 # 31 | mouseOut | css=a > h1 | | 89 element = self.driver.find_element(By.CSS_SELECTOR, "body")90 actions = ActionChains(self.driver)91 # 32 | click | css=.fa-cog | | 92 self.driver.find_element(By.CSS_SELECTOR, ".fa-cog").click()93 # 33 | click | css=.fas | | 94 self.driver.find_element(By.CSS_SELECTOR, ".fas").click()95 # 34 | close | | | 96 self.driver.close()...

Full Screen

Full Screen

login.py

Source:login.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2import random3import settings4from mylib.web import BaseHandler, route5from mylib.captcha import utils6from mylib.session import session7from mylib import tools8from db import controls9@route('/login')10class IndexHdl(BaseHandler):11 @session12 def get(self):13 controls.add_admin()14 vf_txt,v_key = self.gen_verify_text()15 self.session['verifytext'] = vf_txt16 if self.current_user:17 self.redirect('/')18 return19 self.render('login.html',{"v_key":v_key,"hint_info":self.hint_info})20 @session21 def post(self):22 name = self.get_argument('name','').strip()23 passwd = self.get_argument('passwd','').strip()24 action = self.get_argument('action','')25 vf_txt = self.get_argument('vf_txt','').strip()26 vf_txt_session = self.session['verifytext']27 self.session['verifytext'] = ''28 if vf_txt and vf_txt_session and vf_txt.lower() == vf_txt_session.lower():29 if passwd:30 if action=='login':31 self.login(name,passwd)32 elif action == 'sign':33 self.sign(name,passwd)34 else:35 self.set_secure_cookie('info','Submit data error! ')36 self.redirect('/login')37 else:38 self.set_secure_cookie('info','Password can not be empty! ')39 self.redirect('/login')40 else:41 self.set_secure_cookie('info','Verify text is error! ')42 self.redirect('/login')43 @session44 def login(self,name,passwd):45 user = controls.get_user(name,passwd)46 if user:47 self.set_secure_cookie('name',user.name)48 self.session['name'] = tools.make_verifytext_key(user.name)49 self.redirect('/')50 @session51 def sign(self,name,passwd):52 user = controls.add_user(name,passwd)53 if user:54 self.set_secure_cookie('name',user.name)55 self.session['name'] = tools.make_verifytext_key(user.name)56 else:57 self.set_secure_cookie('info','%s用户名已被注册!' % name)58 self.redirect('/')59 def gen_verify_text(self):60 verifytext = utils.getstr(61 random.choice(settings.CPTCH_STR['cpth_len']),62 random.choice(settings.CPTCH_STR['cpth_type']),63 settings.CPTCH_STR['filte_char'])64 v_key = tools.make_verifytext_key(verifytext)65 return verifytext,v_key66@route('/logout')67class LogoutHdl(BaseHandler):68 @session69 def get(self):70 self.set_secure_cookie('name','')71 self.session['name'] = ''...

Full Screen

Full Screen

verify_text.py

Source:verify_text.py Github

copy

Full Screen

1# coding: utf-82# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.4from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F4015from oci.decorators import init_model_state_from_kwargs6@init_model_state_from_kwargs7class VerifyText(object):8 """9 Details to verify text.10 """11 def __init__(self, **kwargs):12 """13 Initializes a new VerifyText object with values from keyword arguments.14 The following keyword arguments are supported (corresponding to the getters/setters of this class):15 :param text:16 The value to assign to the text property of this VerifyText.17 :type text: str18 """19 self.swagger_types = {20 'text': 'str'21 }22 self.attribute_map = {23 'text': 'text'24 }25 self._text = None26 @property27 def text(self):28 """29 Gets the text of this VerifyText.30 Verification text in the response.31 :return: The text of this VerifyText.32 :rtype: str33 """34 return self._text35 @text.setter36 def text(self, text):37 """38 Sets the text of this VerifyText.39 Verification text in the response.40 :param text: The text of this VerifyText.41 :type: str42 """43 self._text = text44 def __repr__(self):45 return formatted_flat_dict(self)46 def __eq__(self, other):47 if other is None:48 return False49 return self.__dict__ == other.__dict__50 def __ne__(self, other):...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful