selenium

测试金字塔的奥秘和数学

£可爱£侵袭症+ 提交于 2021-01-22 09:44:41
三角形的故事 它可能被称为“测试自动化金字塔”,但在大多数情况下看起来都像三角形一样可怕。如果使用吉萨大金字塔的尺寸和本文中讨论的数学方程式,您将最终对测试金字塔的每一层的作用和依赖性以及建立牢固基础的重要性有更深入的了解。 通过将自动测试金字塔视为一个三角形,我们可以使用几何和三角元素查找每个级别的大小。为了弄清楚这一点,我们首先将金字塔分解成3个独立的三角形。我们将确定每个三角形的面积,然后使用切片技术确定每个级别的大小。 我们需要做的第一步是使用来自吉萨大金字塔的这些尺寸来找到三角形的总面积: 使用这些尺寸,我们可以找到组成金字塔一侧的三角形的总面积。 面积=½(230 * 147)≈16905 从顶部(UI级别)开始,我们可以找出每个级别的大小以及它所占整个金字塔的百分比。 用户界面级别 将大金字塔的高度平均分为3个部分,这意味着我们的顶部UI层高49米。 现在,我们可以使用一些三角函数和 勾股定理 来查找该三角形的区域,以查看所涉及的数学细节 。 通过数学运算,我们发现金字塔的UI层的面积为1909.4,约占金字塔总数的11%。 服务级别 使用相同的过程找到中间层的面积,我们发现金字塔的服务层为5726.76,约占金字塔总数的33%。 单位等级 为了找到单位层的面积,我们从测试金字塔的总面积中减去服务和UI层的总面积 16905-5726.76-1909.4 = 9268

selenium+python环境搭建

随声附和 提交于 2021-01-22 09:40:37
selenium介绍: selenium1,也称为seleniumRC或者Remote Control。就是selenium的原本项目。RC是在浏览器启动后,使用js来驱动浏览器的操作。为什么叫RC呢?因为RC的设计是可以支持控制远程服务器上的selenium server来操作远程端的浏览器。 selenium2,也称为selenium webdriver。webdriver原来是另一个自动化测试工具,后与selenium 合并了。webdriver直接调用浏览器本身对自动化支持的接口来驱动浏览器的操作。故名思义,它将有不同的driver来驱动不同系统上不同的浏览器 简单说,selenium项目原本的工具是IDE、RC、grid,然后集成的一个框架。也是目前最流行的的PC B/S架构自动化测试框架。 一、安装python 链接: https://www.python.org/downloads/ 根据自己熟悉版本下载,大体上有2.X和3.X两个版本,新手建议直接入手python3,语法比python2简单易学;安装完成python的安装目录添加到环境变量,方便以后命令窗口符调试;    安装成功python会默认下载好pip和setuptools,python2可能需要另外下载(解压包然后easy_insatll 命令安装) 二、安装selenium pip install

【selenium+python】之Python Flask 开发环境搭建(Windows)

Deadly 提交于 2021-01-22 09:00:48
一、先安装python以及pip 二、其次, Python的虚拟环境安装: 在github上下载 https://github.com/pypa/virtualenv/tree/master zip文件,如图: 把zip包复制到指定文件夹下并解压 将解压的文件夹cd到当前目录后安装,输入:python3 setup.py install ,如图: 安装完virtualenv 后会在python 安装目录的Script目录下看到新生成的文件,如图: 2.创建虚拟环境的目录,在任意目录中打开cmd,输入:virtualenv p3vir 此时当前目录会生成一个p3vir的目录,该目录下的文件结构: 三、Flask的环境安装: Flask的安装,cd到解压后的目录。再分别输入两个执行命令。 (1) 进入python的虚拟环境:输入 d:\PythonEnv\p3vir\Scripts\activate.bat。 (2)输入安装命令:python3 setup.py install 。 Flask 的安装,github 下载地址: https://github.com/mitsuhiko/flask . 安装步骤参照以上。 ....由于安装有误,经过无数次调试,也是无意中安装好的 ,具体内容参见如下文章: 感谢: doago 《Python Flask 开发环境搭建(Windows)》 、

How to Enter text in rich text editor in selenium webdriver?

此生再无相见时 提交于 2021-01-21 11:56:27
问题 We have a rich text editor in our application which we are automating using selenium . Below is the html for the same . <iframe style="height: 76px; width: 1004px;"></iframe> <html><head></head><body spellcheck="false"></body></html> <head></head> <body spellcheck="false"></body> <html><head></head><body spellcheck="false"></body></html> <iframe style="height: 76px; width: 1004px;"></iframe> <div class=""><iframe style="height: 76px; width: 1004px;"></iframe></div> <textarea class="form

Web UI自动化测试之元素定位

99封情书 提交于 2021-01-21 09:39:57
本文首发于: 行者AI 目前,在自动化测试的实际应用中,接口自动化测试被广泛使用,但UI自动化测试也并不会被替代。让我们看看二者的对比: 接口自动化测试是跳过前端界面直接对服务端的测试,执行效率和覆盖率更高,维护成本更低,整体而言投出产出比更高,因此在项目上的使用更广泛。 而UI自动化测试则是模拟用户在前端页面中的操作行为进行测试,虽然在执行过程中易收到其他因素的影响(如电脑卡顿,浏览器卡顿,网速等)而导致用例执行失败,且后期维护成本较高,但是UI自动化测试更贴近用户使用时的真实情况,也能够发现一些接口自动化无法发现的bug。 因此,在实际项目的自动化测试中,通常采用以接口自动化为主、系统稳定后通过UI自动化对重点业务流程进行覆盖的方案。而UI自动化的基础,就是元素定位。只有完成了元素定位,才可以操作定位到的元素,模拟手工测试进行一系列的页面交互,比如点击、输入等。 1. 常用的元素定位方式 对于web端的UI自动化测试,元素定位通常使用selenium提供的以下8种定位方式: id:根据id定位,是最常用的定位方式,因为id具有唯一性,定位准确快捷。 name:通过元素的【name】属性定位,会存在不唯一的情况。 class_name:通过class 属性名称进行定位。 tag_name:通过标签名定位,一般不建议使用。 link_text:专用于定位超链接元素(即a标签)

How do I fix the TypeError raised when trying to find an element using Selenium?

一曲冷凌霜 提交于 2021-01-21 09:23:46
问题 I am trying to scrape all the links from a web page. I am using Selenium WebDriver to scroll and click the load more button present in the web page. The code which I am trying is as shown below: from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import ElementNotVisibleException from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import NoSuchElementException from bs4 import

selenium.JavascriptException: javascript error: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite

…衆ロ難τιáo~ 提交于 2021-01-21 07:10:28
问题 using chrome 78 and chromedriver78 When i click an audio file or try to stop an audio using selenium tests i am getting this error. Error: org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite. Note it happens only with remote webdriver and its not consistent. Error stack trace: When the audio player of the "item_1" element is stopped in "[data-rcfid='checkbox_7']" org.openqa.selenium

how to enter numeric value into textbox in webdriver

主宰稳场 提交于 2021-01-21 06:15:10
问题 How to enter numeric value into textbox in Selenium webdriver. The code is below: sendKeys() method is not working for numeric value, is there any alternative command for the integers. @FindBy(id="toolbox-options-key") private WebElement BillingRateTextBox; public void createNewBill(String billingRate) { BillingRateTextBox.sendKeys(10); } 回答1: You need to convert the Integer to String and pass them to sendKeys like this: element.sendKeys(String.valueOf(number)) 回答2: running this: paris

how to enter numeric value into textbox in webdriver

99封情书 提交于 2021-01-21 06:15:10
问题 How to enter numeric value into textbox in Selenium webdriver. The code is below: sendKeys() method is not working for numeric value, is there any alternative command for the integers. @FindBy(id="toolbox-options-key") private WebElement BillingRateTextBox; public void createNewBill(String billingRate) { BillingRateTextBox.sendKeys(10); } 回答1: You need to convert the Integer to String and pass them to sendKeys like this: element.sendKeys(String.valueOf(number)) 回答2: running this: paris