Exemple #1
0
#!/sur/bin/python
# -*-coding:utf-8-*-
from appium import webdriver
from time import sleep
import yaml
import pytest
from until.ReadDate import s
from until.mylog import get_logger

log = get_logger(filename="test_1.py")

with open(file=r'E:\QQ\element\login.yaml', mode='r', encoding='utf-8') as f:
    e = yaml.load(f, Loader=yaml.FullLoader)
    # print(e)

# d = {
#     "platformName": "Android",                            #系统型号
#     "platformVersion": "5.1.1",                           #系统版本
#     "deviceName": "emulator-5554",                        #系列号
#     "appPackage": "com.tencent.mobileqq",                 # 安装包名
#     "appActivity": ".activity.SplashActivity",            #活动栈
#     "noReset": "true",                                    #
#     "unicodeKeyboard": "true"
# }
# #  建立连接,并开启QQ程序
# dr = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_capabilities=d)
# #  等待程序启动
# sleep(10)
# #执行退出账号的操作

# def test_One(lian):
Exemple #2
0
#!/sur/bin/python
# -*-coding:utf-8-*-
from appium import webdriver
from time import sleep
import yaml
import pytest
from selenium.common.exceptions import NoSuchElementException
from until.mylog import get_logger
from until.ReadDate import s

log = get_logger(filename="test_10.py")  #  产生日志文件的脚本名

with open(file=r'E:\QQ\element\login.yaml', mode='r', encoding='utf-8') as f:
    e = yaml.load(f, Loader=yaml.FullLoader)
with open(file=r"E:\QQ\data\login.txt", mode="r", encoding="utf-8") as fb:
    datas = fb.read().split(";")
    # print(datas)


@pytest.mark.parametrize("y1,y2", s)
def test_2(y1, y2, lian):
    # 先清除账号
    lian.find_element_by_accessibility_id(e['zhanghuming']).clear()
    sleep(2)
    # 在输入账号
    log.info(f"账号{y1}")
    lian.find_element_by_accessibility_id(e['zhanghuming']).send_keys(y1)
    sleep(2)
    # 在输入密码
    log.info(f"密码{y2}")
    lian.find_element_by_id(e['password']).clear()
Exemple #3
0
#!/usr/bin/python
#-*-coding:utf-8-*-
import requests
import pytest
from until.shuju import shuju, wu
from until.mylog import get_logger

log = get_logger(filename='test.py')


@pytest.mark.parametrize('x,y', shuju)
def test_1(x, y):
    url = "http://v.juhe.cn/cccn/to_telecodes.php"
    querystring = {"key": f"{x}", "chars": f"{y}"}
    log.info(f'输入的参数为:"key":f"{x}","chars":f"{y}"')
    headers = {
        'User-Agent': "PostmanRuntime/7.15.2",
        'Accept': "*/*",
        'Cache-Control': "no-cache",
        'Postman-Token':
        "b756ead2-0c78-44a3-8463-35bf56d6b02f,6b3ebdea-30b9-4e18-b205-261e04bd5d35",
        'Host': "v.juhe.cn",
        'Cookie': "aliyungf_tc=AQAAAPLgQHGeDAIA9rU3cyUP3rxyzqM5",
        'Accept-Encoding': "gzip, deflate",
        'Connection': "keep-alive",
        'cache-control': "no-cache"
    }
    # 使用的get请求方法    使用params 加参数值
    # 使用的post请求方法    使用data 加数据
    response = requests.request("GET",
                                url,
Exemple #4
0
#!/usr/bin/python
#-*-coding:utf-8-*-
from selenium import webdriver
from time import sleep
from selenium.webdriver.support import ui
from selenium.webdriver import ActionChains
from until.mylog import get_logger
log = get_logger('test.py')


def test(dr):
    log.info('输入网址')
    dr.get('https://mail.163.com/')
    assert dr.title == '163网易免费邮--中文邮箱第一品牌'
    log.info('成功登录网址')


def test_1(dr):
    sleep(2)
    dr.find_element_by_id('switchAccountLogin').click()
    log.info('单击账号密码登录')
    dr.switch_to.frame(
        dr.find_element_by_xpath('//*[@frameborder="0" and @scrolling="no"]'))
    dr.find_element_by_name('email').send_keys('13592386651')
    log.info('输入账号:13592386651')
    dr.find_element_by_name('password').send_keys('981007.li')
    log.info('输入密码:981007.li')
    dr.find_element_by_id('dologin').click()
    log.info('单击登录')
    print(dr.title)
    assert dr.title == '网易邮箱6.0版'