Selenium is also a tool for Web application testing. The selenium test runs directly in the browser, just as the real user is doing. Supported browsers include IE, Mozilla Firefox, Mozilla Suite, and more. The main features of this tool include: test and browser compatibility--test your application to see if it works well on different browsers and operating syste
I. Environmental construction
The preparation tools are as follows: Download python "Python Development Environment" (http://python.org/getit/)
Download Setuptools: "Python's Basic Package Tool" (Http://pypi.python.org/pypi/setuptools
Download pip: "Python installation package management tool" (HTTPS://PYPI.PYTHON.ORG/PYPI/PIP)
Setuptools is a Python-based package tool that can help us easily download, build, install, upgrade, and uninstall Python packagesPip is a Python so
The client side primarily uses an ant build file to start JUnit's testcase, which in turn launches the test method in TestCase to connect and activate the server side for automated testing. The code for the client-side core test unit is as follows: Java code packagecom.tail.p2test; importjunit.framework.test; importjunit.framework.testcase; importjunit.framework.testsuite; importjunit.textui.testrunner; importcom.thoughtworks.selenium.defaults
For the general login site, there will be a verification code this thing, is generally for security considerations, in a security policy, this is a problem for us to do UI Automation testing, normal we can enter the user name, password to log in, if the popup verification code to deal with, It's a good choice to take a browser cookie.Recommended Chrome plugin Editthiscookie, you can directly see the current site is using the cookie, for our login, we
Web login testing is a very common test! Manual test Everyone is familiar with, how to do automated login test it! In this paper, the author uses python+selenium combined with UnitTest Unit Test framework to conduct a simple but relatively complete cnblog automated login test, to provide you with a point of reference! The following includes the test code and each of the test cases:The login test of the Cnbl
Automated tests that have been done with the UI know that testing is an action on an element, so it is particularly dependent on the positioning of the element. But this poses a big problem-"maintenance cost", if you are positioned multiple times with an element in a different test case script, and when the position or attribute of the element changes, you must find the corresponding location in the script to modify it.
Page ObjectPage objects mode is
Python + Selenium notes (12): data-driven testing, pythonselenium
(1)Preface
Data-driven tests are used to parameterize input values and expected results. (For example, you can directly read the data in the Excel document by entering data and expected results)
(2)Ddt
Using ddt to perform a data-driven test, the ddt database can parameterize the variables in the test. When using ddt, use the @ ddt modifier i
Problem: Selenium when you start Firefox, you use a new profile as the startup profile, which is not available in Firefox settings manually.Workaround: Locate the profile directory when Firefox is manually started and pass Firefoxprofile to Webdriver in the test program1. View the profile directorycommand line, go to the Firefox installation directory (more: C:\Program Files (x86) \mozilla Firefox), executeFirefox.ext-pOrFirefox.exe-profilemanagerThe
The Selenium control browser needs to download the corresponding version of the driver and unzip the downloaded driver and then copy it to the Python installation directory.1. ChromeDrive the corresponding version and; https://npm.taobao.org/mirrors/chromedriver/2. FirefoxDrive; https://github.com/mozilla/geckodriver/releases/3. IEDrive; http://www.cr173.com/soft/195732.htmlenable protected mode for IEOpen ie--"Set--" Internet Options--"security--" to
Background: In the testing process, in order to achieve the implementation of the different test data batch cycle input, consider the need to read the CSV file by the way of parameterization of the steps to further parameterization, the sample code is as follows:Import CSV...Data_set = R ' C:\\test.csv 'data = Csv.reader (file (Data_set, ' RB '))def test_insert (self):...# A total of four fields for each data to be enteredInfo0 = 0INFO1 = 1Info2 = 2In
AssertisnotnoneAssertisnone: Does not exist, then passAssertisnotnone: exists, then passTake a look at the specific use of the methodSelf.driver.find_element_by_xpath ("//android.widget.linearlayout[1]/android.widget.textview[1]"). Click ()#点击登录入口sleep (2) Self.driver.find_element_by_xpath ( "// ANDROID.WIDGET.LINEARLAYOUT[1]/ANDROID.WIDGET.EDITTEXT[1]. Send_keys ( "testq1") #输入用户名sleep (2) Self.driver.find_element_by_xpath ( "//android.widget.linearlayout[2]/android.widget.edittext[1]"). Sen
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.