引用
速度
setSpeed 500
打开页
open /
waitForPageToLoad
验证 DOM
waitForElementPresent //DIV[@id='btnDirectLr']
waitForElementPresent //DIV[text()='库存报表']
verifyElementPresent css=div#msg-div:contains("审核成功")
waitForElementPresent //DIV[@id='btnNew']
waitForElementPresent //div[contains(@class, 'x-mask-msg') and contains(@style, 'display: none')]
waitForElementNotPresent //DIV[@id='winForm' and contains(@style, 'visibility: hidden')]
单击
click //DIV[text()='库存报表']
click id=btnNew
click //DIV[@id='btnNew']/em/button
click //label[text()='仓库:']/following-sibling::div/div/div
click css='li.x-boundlist-item'
iframe
selectFrame content-iframe
waitForFrameToLoad
selectFrame relative=up
store
storeText //div[@id='grdMain']/div[2]/div/table/tbody/tr[2]/td[2]/div name
store 2 ckQty
storeEval storedVars['oldQty']-storedVars['ckQty'] newQty
echo ${name}
verify
verifyText //div[@id='grdMain']/div[2]/div/table/tbody/tr[2]/td[2]/div ${name}
verifyText "css=div#grdMain td.x-grid-cell:nth-child(6) div" ${name}
form
type //input[@name='item[product_id]'] ${name}
keyUp //input[@name='item[product_id]'] w
waitForElementPresent //div[contains(@class, 'x-mask-msg') and contains(@style, 'display: none')]
waitForElementNotPresent //DIV[@id='blProducts' and contains(@class, 'display: none')]
click //DIV[@id='blProducts']/div/ul/li[1]/a
click //DIV[@id='btnWinLiSave']/em/button
click //DIV[@id='btnWinSave']/em/button
waitForElementPresent //div[contains(@class, 'x-mask-msg') and contains(@style, 'display: none')]
select grid row & audit
mouseDown //div[@id='grdMain']/div[2]/div/table/tbody/tr[2]/td
click //DIV[@id='btnAudited']/em/button
click //div[contains(@class, 'x-window x-message-box')]/div[3]/div/div[2]/em/button
waitForElementPresent //div[contains(@class, 'x-mask-msg') and contains(@style, 'display: none')]
提示
runScript msg = '<div id="selenium-msg" style="background-color: orange;border-radius: 10px;font-size: 20px;left: 500px;line-height: 50px;position: absolute; text-align: center;top: 5px;width: 600px;z-index: 10000;"></div>'; Ext.DomHelper.insertFirst(Ext.getBody(), msg, true);
runScript Ext.get('selenium-msg').dom.innerHTML = '测试物料出库库存变化';
runScript Ext.get('selenium-msg').dom.innerHTML = '得到测试数据';
runScript Ext.get('selenium-msg').dom.innerHTML = '测试完成';
Ext tree 加载成功
waitForCondition !selenium.browserbot.getCurrentWindow().Ext.getCmp('treMain').getStore().loading 2000
Click Ext tree node
click css=div#treMain .x-grid-row .x-grid-cell-inner:contains('库存报表')
消息框没有隐藏
waitForCondition selenium.browserbot.getCurrentWindow().Ext.MessageBox.isHidden() 1000
存/得 Ext 数据
storeEval selenium.browserbot.getCurrentWindow().Page.grid.getStore().data.items[0].data product
storeEval storedVars['product'].product_code name
Ext window 显示
waitForCondition selenium.browserbot.getCurrentWindow().Page.win.isVisible() 1000
Ext Combobox 处理
runScript Page.frm.getForm().findField("item[warehouse_id]").expand()
waitForCondition selenium.browserbot.getCurrentWindow().Ext.getCmp('frmMain').getForm().findField("item[warehouse_id]").isExpanded 1000
runScript Page.frm.getForm().findField("item[warehouse_id]").select(1)
runScript Page.frm.getForm().findField("item[warehouse_id]").collapse()
Ext recordselect 处理
type //input[@name='item[product_id]'] ${name}
keyUp //input[@name='item[product_id]'] w
waitForCondition selenium.browserbot.getCurrentWindow().Ext.MessageBox.isHidden() 1000
waitForCondition selenium.browserbot.getCurrentWindow().Ext.getCmp('frmLi').getForm().findField("item[product_id]").isExpanded 1000
click dom=selenium.browserbot.getCurrentWindow().Ext.getCmp('frmLi').getForm().findField("item[product_id]").getPicker().getNodes()[0]
runScript Ext.getCmp('frmLi').getForm().findField("item[product_id]").collapse()
Ext grid 加载完成
waitForCondition !selenium.browserbot.getCurrentWindow().Page.grid.getStore().loading 2000
得到 Ext grid 数据
storeEval selenium.browserbot.getCurrentWindow().Page.grid.getStore().data.items[0].data.code ckBillCode
echo ckBillCode: ${ckBillCode}
click Ext message yes
click css=div#btnAudited em button
click dom=selenium.browserbot.getCurrentWindow().Ext.MessageBox.msgButtons.yes.btnEl.dom
verifyElementPresent css=div#msg-div:contains("审核成功")
verify Ext grid cell value
verifyText css=div#grdMain td.x-grid-cell:nth-child(6) div ${newQty}.0
分享到:
相关推荐
python+selenium项目源码,内涵常用selenium功能的示例代码。
好了,直入主题,由于开源社区不再维护selenium 1.x再加之更为先进的selenium 2.0确实有不少优势之初可以完全取代1.x,在这里笔者会花一些笔墨,若干篇幅,争取深入浅出的讲解selenium 2.0的一些基本知识,常用方法...
基于python的selenium UI自动化测试框架,采用Page Object设计模式进行二次开发,通过对页面对象和测试代码进行分离,并封装了日志输出,浏览器引擎选择,二次封装常用方法
使用FluentSelenium的测试代码更简洁,更优雅。 在许多好处中,FluentSelenium将尝试透明地超越过时的元素异常业务。 FluentSelenium可与Java的JUnit,TestNG,ScalaTest,JBehave,Cucumber或您喜欢的任何JDK...
这篇文章主要介绍了SELENIUM自动化模拟键盘快捷键操作实现解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 平常我们会用到很多快捷键,那么selenium如何来...
#Robot-Framework-Formatter源代码Selenium IDE:Robot Framework Formatter seleniumLibrary.robot: : 这些是运行Robot Framework的常用关键字,您可以编写一些关键字来改善这一点。 用户指南: 安装...
这是个人对selenium.webdriver写的一些常用操作的二次封装,也就相当于重写了,不再使用自带的框架,用自己写的框架完成。这样的话使代码更简洁,用自己的思想完成代码的编写。 首先在根目录下创建子目录名为...
除了合并两者,本库还以网页为单位封装了常用功能,简化了 selenium 的操作和语句,在用于网页自动化操作时,减少考虑细节,专注功能实现,使用更方便。 一切从简,尽量提供简单直接的使用方法,对新手更友好。 ...
更棒的是,它的使用方式非常简洁和人性化,代码量少,对新手友好。 项目地址: 示例地址: 联系邮箱: 交流QQ群: 897838127 理念 简洁,易用,可扩展 背景 请求爬虫面对要登录的网站时,要分析数据包,JS源码,...
一、常用参数 参数 说明 –headless 开启无界面模式(服务器中不加此配置会报错) –user-agent=请求头 配置对象添加User-Agent –window-size=1000,500 设置浏览器窗口大小 –start-maximized 全屏窗口...
目录 第一章、任务描述 3 第二章、 Python开发环境的构建 4 2.1 Python解释器的安装 4 2.2. Python 开发的集成开发环境搭建(Pycharm) 5 2.3.安装 Python爬虫第三方库 6 2.3.1安装 selenium 库...第七章、 附录代码 32
Java ------tcp三次握手过程、最后一次的状态,英文;为什么是四次挥手,不是三次 Python ------ unittest 和 pytest 的区别? ------使用 Python+Locusts 做性能测试 MySQL ...常用的实践性问题简述
具有一些常用功能的抽象 PageObject 支持主要浏览器(Firefox、Chrome、Edge、InternetExplorer) 支持使用 appium 进行移动测试(Android、iOS) 要求 目前使用版本为 [3.141.59] 的 Selenium 使用版本为 [5.7.0...
在一个简单的游乐场中包含最常用的代码构造,可用于学习JAVA代码原理。 类中的每个程序包都包含一些JAVA原则以及可用于学习目的的注释。 安装 安装IDE(推荐:IntelliJ IDEA) 安装Java JDK(从以下下载: : ) ...
常用的集成测试框架有Selenium、Appium等。 4) 性能测试:通过模拟多种负载情况,测试系统的性能和响应时间。 5) 安全测试:测试系统的安全性和防御能力,发现潜在的安全漏洞和风险。 3、分如下四种语言: 1)JAVA...
基于Java selenium的web 自动化 代码主体结构 .properties 定义页面元素的xpath PageObject 封装页面的元素对象,并根据xpath初始化 封装页面的常用方法 TestCase 业务脚本逻辑,测试用例 testdata 存放的测试数据 ...
Vantpy2.0 关于更新1.21 Vantpy更新的内容: 兼容Linux系统,mac系统,跨...框架集成了Selenium的常用定位方法,使元素定位更加方便 使用HTMLTestRunner作为自动生成测试报告,报告更加美观,更加详细,内容更丰富 Lo
主要介绍了使用flask、requests、BeautifulSoup、Threading、Scrapy、selenium等常用库和框架进行爬虫开发的技巧和方法,并结合实际案例进行了详细讲解。适用于对Python爬虫开发感兴趣的初学者和有一定编程基础的...
ActionChains 类提供了鼠标操作的常用方法: perform() 执行所有ActionChains中存储的行为 context_click() 右击 double_click() 双击 drag_and_drop() 拖动 move_to_element() 鼠标悬停 二、详细使用...
Python 是一个常用的选择,其中的采用 selenium 用于模拟浏览器 HTTP 请求获取网页内容,BeautifulSoup 用于解析 HTML内容; 2. 编写爬虫代码: a. 抓取网页数据: b. 发送GET请求到包含股票涨幅信息的页面。 c. ...