# Author:zhang
# -*- coding:utf-8 -*-
"""https://workyun.com/ 云端工作
"""
import unittest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import time
class LoginCase(unittest.TestCase):
def setUp(self):
"前置条件"
self.driver=webdriver.Chrome()
self.driver.maximize_window() #最大化 def driverxpath(self,xpath): #定义方法去查看页面元素是否粗在
for i in range(30):
try:
element = self.driver.find_element_by_xpath(xpath)
if element.is_displayed():
return self.driver.find_element_by_xpath(xpath)
break
except:pass
time.sleep(1)
else:
print("time-out") def login(self,name,passwd): #定义登录的方法
"登录"
self.driver.get("http://www.effevo.com ")
self.driver.implicitly_wait(5)
self.driver.find_element_by_class_name("login-in").click()
self.driver.find_element_by_id("passname").send_keys(name)
self.driver.find_element_by_id("password").send_keys(passwd)
self.driver.find_element_by_class_name("ee-btn-ok").click() #登录参数化 def zeng(self,tuanname,hao):
"增加团队"
self.driverxpath(".//*[@id='leftNav']/div[2]/div[1]/ul/li/a/i").click()
time.sleep(5)
self.driverxpath("html/body/div[4]/div/div[2]/div/input").send_keys(tuanname) #团队名称
self.driverxpath("html/body/div[4]/div/div[3]/button[1]").click()
# 选择用户 self.driver.find_element_by_xpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/div/ul/li[1]/a").click()
self.driverxpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/input").send_keys(hao) #手机号码
self.driverxpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/div/button").click() #选择管理员
time.sleep(3)
self.driverxpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/div/ul/li[1]/a").click()
time.sleep(3)
self.driverxpath("/html/body/div[4]/div/div[3]/button[1]").click()
time.sleep(10) def tianjia(self,tihao):
"添加成员"
# self.driver.implicitly_wait(30)
# self.driver.find_element_by_xpath(".//*[@id='mCSB_1_container']/li[2]/a/div[1]").click()
self.driver.implicitly_wait(35)
self.driverxpath(".//*[@id='team-index']/div/ul/li[2]/span").click()
self.driver.find_element_by_css_selector(".user-new-text").click()
self.driver.find_element_by_css_selector(".user-invite-input.ng-pristine.ng-valid").send_keys(tihao)
self.driverxpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/div/button").click()
time.sleep(5)
self.driverxpath("html/body/div[4]/div/div[2]/div/div[2]/div/div/div/div/div[1]/div/div/ul/li[3]/a").click()
self.driverxpath("html/body/div[4]/div/div[3]/button[1]").click() #保存新增的用户 def delte(self,mima):
"删除端对"
self.driver.refresh() #刷新页面
time.sleep(20) #显示等待
self.driverxpath(".//*[@id='mCSB_1_container']/li[2]/a/div[1]").click() #点击下左侧的团队名
time.sleep(20)
self.driverxpath(".//*[@id='team-index']/div/ul/li[3]/span").click() #设置按钮
self.driverxpath(".//*[@id='team-index']/ui-view/div/p[10]/button").click()
self.driverxpath(".//*[@id='re-verify-password-modal']/div/div/div[2]/input").send_keys(mima)
self.driverxpath(".//*[@id='re-verify-password-modal']/div/div/div[3]/div/button[2]").click()
time.sleep(5)
# def test_login(self):
# "这个是正常的e"
# self.login("75236@qq.com","x1400184")
# time.sleep(5)
# s=self.driver.title
# self.assertIn(u"列表",s)
# self.driver.implicitly_wait(10) # def test_zeng(self):
# #增加团队
# self.login("75286@qq.com","x1460184")
# time.sleep(5)
# self.zeng("ceshi","140184@qq.com")
# #self.assertEqual()
# #s=self.driver.find_element_by_link_text(".//*[@id='mCSB_1_container']/li[2]/a/div[1]"). #怎样进行验证 def xiangmu(self,projectname,description):
"在团队下面添加项目"
self.driver.refresh() #刷新页面
time.sleep(20)
self.driverxpath(".//*[@id='mCSB_1_container']/li[2]/a/div[1]").click() #点击团队名称
self.driverxpath(".//*[@id='team-project-overview']/div[5]/div").click() #点击创建项目
self.driverxpath(".//*[@id='project-edit-modal']/div/div/div[2]/div[2]/input").send_keys(projectname) #项目名
self.driverxpath(".//*[@id='project-edit-modal']/div/div/div[2]/div[3]/textarea").send_keys(description) #项目描述
self.driverxpath(".//*[@id='project-edit-modal']/div/div/div[3]/div/span[2]").click() #保存项目 def renwu(self,renwuname):
self.driver.refresh() #刷新页面
time.sleep(3)
self.driver.refresh()
time.sleep(20)
self.driverxpath(".//*[@id='mCSB_1_container']/li[2]/a/div[1]").click() #点击团队名称
self.driverxpath(".//*[@id='team-project-overview']/div[2]/div/table/tbody/tr/td[1]").click() #点击项目
#self.driver.switch_to(".//*[@id='mCSB_2_container']")
# WebDriverWait(self.driver,20).until(lambda x:x.find_element__by_xpath(".//*[@id='mCSB_2_container']/div[2]/input")).click
self.driverxpath(".//*[@id='mCSB_2_container']/div[2]/input").click
# self.driver.find_element_by_xpath(".//*[@id='mCSB_2_container']/div[2]/input").click() #点击任务名
#//*[@id='mCSB_2_container']/div[2]/input
#WebDriverWait(self.driver, 20).until(lambda x: x.find_element_by_xpath(".//*[@id='mCSB_2_container']/div[2]/input"))
self.driverxpath(".//*[@id='mCSB_2_container']/div[2]/input").send_keys(renwuname)
self.driver.switch_to.default_content() def test_dele(self):
#删除团队
self.login("397986@qq.com","01660184")
time.sleep(5)
self.zeng("rrrr","1660184@qq.com")
self.tianjia("zzq14184@163.com")
time.sleep(5)
self.xiangmu("xinu","beautiful")
self.renwu("renwuming") def tearDown(self):
"后置条件"
time.sleep(5)
# self.driver.quit() if __name__=='__main__':
unittest.main() #执行用例

yun的更多相关文章

  1. 指示灯组与3个复位按钮的介绍Arduino Yun快速入门教程

    指示灯组与3个复位按钮的介绍Arduino Yun快速入门教程 1.4.2  指示灯组 指示灯组的放大图如图1.5所示. 图1.5  指示灯组 各个指示灯对应的功能如下: q  RX:对应于0号端口, ...

  2. Use Node.js DDP Client on Arduino Yun to Access Meteor Server

    Use Node.js DDP Client on Arduino Yun to Access Meteor Server 概述 在Arduino Yun上安装 Node.js, 并測试与 Meteo ...

  3. ArduinoYun教程之配置Arduino Yun环境

    ArduinoYun教程之配置Arduino Yun环境 配置Arduino Yun 不管你使用前面介绍的哪种方式连接Arduino Yun.如今都能够配置你的Arduino Yun了.首先须要的是使 ...

  4. ArduinoYun教程之OpenWrt-Yun与CLI配置Arduino Yun

    ArduinoYun教程之OpenWrt-Yun与CLI配置Arduino Yun OpenWrt-Yun OpenWrt-Yun是基于OpenWrt的一个Linux发行版.有所耳闻的读者应该听说他是 ...

  5. ArduinoYun教程之通过网络为Arduino Yun编程

    ArduinoYun教程之通过网络为Arduino Yun编程 Arduino Yun的软件部分 通过第一章的介绍后读者就明白了Arduino Yun除了是一个类似其他Arduino的单片机之外,它的 ...

  6. 入手Arduino Yun,配合Blynk搞一波事情

    前言 原创文章,转载引用务必注明链接. 最近在闲鱼上与别人用RPi2尸体+好的BBB换了个Arduino Yun,等了几天赶在节前收到了.出奇的轻巧,产地台湾,官方正品做工就是精细~采用5v Micr ...

  7. Arduino Yun高速新手教程(大学霸内部资料)

    Arduino Yun高速新手教程(大学霸内部资料) 本资料为国内第一本Arduino Yun教程.具体解说Arduino Yun的基本结构.开发环境.系统配置.并着力解说关键功能--Bridge.最 ...

  8. linux下配置yun源

    备份原yum源   /etc/yum.repos.d/centos一base.repo 下载yum源       wagt 源网址/源名称/etc/yum.repos.d/原yum名

  9. Homebrew -- Mac软件管家(套件管理yun……)

    也许是之前使用linux系统的时候总是习惯使用wget 在mac中只有curl,有点略显不习惯 于是乎某天在搜索mac开发者的时候发现了Homebrew这个东西 ok,是那么句话--惰性是人的天性 有 ...

  10. Linux yun命令使用报错:File "/usr/bin/yum", line 30 except KeyboardInterrupt, e:

    原文参考:https://www.cnblogs.com/caiji/p/7891923.html 使用yum更新perl源,报错 问题出现原因: yum包管理是使用python2.x写的,将pyth ...

随机推荐

  1. redis整合Spring集群搭建及业务中的使用

    1.redis安装 Redis是c语言开发的. 安装redis需要c语言的编译环境.如果没有gcc需要在线安装.yum install gcc-c++ 安装步骤: 第一步:redis的源码包上传到li ...

  2. 一、linux 内核介绍

    参考文档: linux 内核剖析:https://www.ibm.com/developerworks/cn/linux/l-linux-kernel/ 1.1 linux 内核历史 在 20 世纪 ...

  3. flash 概要分析器

    这个东东 调试用.会每毫秒一次记录正在运行的函数 及相关数据    只在调试版flash player才能用. startSampling  开始记录 getSamples  获取记录 Sample ...

  4. ELK平台搭建(下)

    1. 目的 为指导在Centos6.8系统下搭建标准ELK平台的工作,特编写本施工文档. 2. 定义 Elasticsearch Logstash Kibana结合Redis协同工作. 3. 适用范围 ...

  5. spring cloud(学习笔记)微服务启动错误(1)

    今天下午在启动spring cloud微服务的时候,报了这个错误: Error starting ApplicationContext. To display the auto-configurati ...

  6. delegate事件委托

    下面举个例子 我们希望通过点击使得点击的li标签变红 <body style="height:2000px;"> <ul> <li>1111&l ...

  7. 下面那些是无效的Java标识符?

    下面那些是无效的Java标识符?为什么? a.RESULT b.result c.12345 d.x12345y e.black&white f.answer_7 c和e是无效的,因为标识符不 ...

  8. shellb编程 之 实践出真知

    1.查询file1 里面空行的所在行号 纯空行:awk ‘{if($0~/^$/)print NR}’ file 空行和带空格,制表符等的行:awk '$0~/^\s*$/' file 2.查询fil ...

  9. P4553 80人环游世界

    题目地址:P4553 80人环游世界 上下界网络流 无源汇上下界可行流 给定 \(n\) 个点, \(m\) 条边的网络,求一个可行解,使得边 \((u,v)\) 的流量介于 \([B(u,v),C( ...

  10. JavaWeb - Servlet教程

    http://www.runoob.com/servlet/servlet-tutorial.html