随笔分类 -  python自动化测试

摘要:Selenium Grid(一)环境搭建Selenium Grid(二)控制远程电脑运行自动化 首先本地启动hub节点 java -jar selenium-server-standalone-3.141.59.jar -role hub 本地也可以启动node节点(多个node需要指定不端口号) 阅读全文
posted @ 2021-04-26 15:29 OTAKU_nicole 阅读(563) 评论(0) 推荐(0)
摘要:Selenium Grid(一)环境搭建Selenium Grid(二)控制远程电脑运行自动化 1、下载Selenium Server 下载地址:http://www.seleniumhq.org/download 2、配置java环境(https://www.cnblogs.com/nicole- 阅读全文
posted @ 2021-04-21 17:06 OTAKU_nicole 阅读(490) 评论(0) 推荐(0)
摘要:str.isalnum() # 所有字符都是数字或字母 str.isalpha() # 所有字符都是字母 str.isdigit() # 所有字符都是数字 str.islower() # 所有字符都是小写 str.isupper() # 所有字符都是大写 str.istitle() # 所有单词都是 阅读全文
posted @ 2020-03-19 16:45 OTAKU_nicole 阅读(488) 评论(1) 推荐(0)
摘要:import datetime #十位时间戳 timeStamp = 1568131200 otherStyleTime = datetime.datetime.utcfromtimestamp(timeStamp).strftime("%Y-%m-%d %H:%M:%S") print(other 阅读全文
posted @ 2019-09-10 16:48 OTAKU_nicole 阅读(293) 评论(0) 推荐(0)
摘要:import pinyin.cedict # 转拼音 # nǐhǎo print(pinyin.get('你好')) # ni hao print(pinyin.get('你好', format="strip", delimiter=" ")) # ni3hao3 print(pinyin.get('你好', format="numerical")) # 获取首字母 n h ... 阅读全文
posted @ 2019-03-07 15:18 OTAKU_nicole 阅读(3295) 评论(0) 推荐(0)
摘要:import unittest import paramunittest @paramunittest.parametrized( {"server": "AAA","url": "AAA_URL"}, {"server": "BBB","url": "BBB_URL"}, {"server": "CCC","url": "CCC_URL"}, ) clas 阅读全文
posted @ 2019-03-07 13:54 OTAKU_nicole 阅读(1258) 评论(0) 推荐(0)
摘要:import datetime today = datetime.date.today() print(today) #2019-02-25 #加一天 tomorrow = today + datetime.timedelta(1) print(tomorrow) #2019-02-26 #減一天 yesterday = today + datetime.timedelta(-1) pr... 阅读全文
posted @ 2019-02-25 17:19 OTAKU_nicole 阅读(657) 评论(0) 推荐(0)
摘要:import autoit from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.***.cn") # 一系列操作之后,打开了选择窗口 # 焦点到文件名选择框 autoit.control_focus("打开", "Edit1") # 选择一个文件 path = "F:\***\... 阅读全文
posted @ 2019-02-25 17:06 OTAKU_nicole 阅读(367) 评论(0) 推荐(0)
摘要:from PIL import Image from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("https://www.***.cn") filename = "image.png" #截屏 driver.save_... 阅读全文
posted @ 2019-02-25 16:50 OTAKU_nicole 阅读(2815) 评论(0) 推荐(0)
摘要:from PIL import Image from pytesseract import image_to_string code = image_to_string(Image.open("code.png")) print(code) 阅读全文
posted @ 2019-02-25 16:22 OTAKU_nicole 阅读(1063) 评论(0) 推荐(0)
摘要:import smtplib from email.header import Header from email.mime.text import MIMEText def send_mail(receiver = '***@qq.com'): # 邮件服务器 smtpserver = 'smtp.163.com' # 发件人和密码 sender = '***... 阅读全文
posted @ 2019-02-18 11:39 OTAKU_nicole 阅读(850) 评论(0) 推荐(0)
摘要:import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.header import Header def send_mail(report_name, receiver ='***@qq.com'): ''' 发... 阅读全文
posted @ 2019-02-18 11:39 OTAKU_nicole 阅读(909) 评论(0) 推荐(0)
摘要:from selenium import webdriver option = webdriver.ChromeOptions() # 伪装iphone option.add_argument('--user-agent=iphone') # 伪装android # option.add_argument('--user-agent=android') driver = webdriver.C... 阅读全文
posted @ 2019-02-18 11:26 OTAKU_nicole 阅读(1600) 评论(1) 推荐(0)
摘要:执行顺序 setUpClass->setUp->testA->tearDown->setUp->testB>tearDown->tearDownClass 用例之间按用例名称ASCII码的顺序加载,数字与字母顺序为0~9,A~Z,a~z, 所以testA会在testB之前运行。 阅读全文
posted @ 2019-02-15 17:49 OTAKU_nicole 阅读(2683) 评论(0) 推荐(1)
摘要:显式等待 在设置时间内,每间隔一段时间检查一次当前页面元素是否存在,如超过设置检查时间检查不到就抛出异常。 隐式等待(implicitly_wait)通过一定时长等待页面上某元素加载完成,默认是0,如超出了设置的时长元素还没加载完成,则抛出NoSuchElementException异常。 slee 阅读全文
posted @ 2019-02-15 17:06 OTAKU_nicole 阅读(208) 评论(0) 推荐(0)
摘要:from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.***.cn") #有id的,用id定位,id=iframe1 driver.switch_to.frame("iframe1") # 阅读全文
posted @ 2019-02-15 16:14 OTAKU_nicole 阅读(794) 评论(0) 推荐(0)
摘要:from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() driver.get("https://www.***.cn") #回车 driver.fi... 阅读全文
posted @ 2019-02-15 16:05 OTAKU_nicole 阅读(1122) 评论(0) 推荐(0)
摘要:from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("https://www.***.cn") #通过ID定位 driver.find_element(By.ID,"qcreatetask") #通过CSS... 阅读全文
posted @ 2019-02-15 15:56 OTAKU_nicole 阅读(705) 评论(0) 推荐(0)
摘要:from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select driver = webdriver.Chrome() driver.get("https://www.***.cn") #获取文本 te... 阅读全文
posted @ 2019-02-15 14:58 OTAKU_nicole 阅读(329) 评论(0) 推荐(0)
摘要:from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.get("https://www.***.cn") ele = driver.find... 阅读全文
posted @ 2019-02-15 14:24 OTAKU_nicole 阅读(420) 评论(0) 推荐(0)