I have long wanted to write some selenium test framework, but time and ideas are not very mature. Today, I would like to share with you roughly.
The background of this paper assumes that the reader has a certain experience in selenium use.
1. Element positioning
As you all know, the Web page this thing in the browser is a complete XML, so you can access the XM
the Searchtest class and All test methods in the Homepagetest class search_test =unittest. Testloader (). Loadtestsfromtestcase (searchtest) Home_page_test = UnitTest. Testloader (). Loadtestsfromtestcase (homepagetest) # Create a test suite that includes Searchtest and Homepagetest Smoke_tests =unittest. TestSuite ([home_page_test,search_test]) # opens the file in binary form for writing ou
Notoginseng - " " the to generate an HTML-based test report: + 1 Defining a path to a file A 2 Opening a file in a written manner the 3 Calling the Htmltestrunner method to generate a test report + 4 running a test collection - 5 closing Files $ " " $report_file=". \\20170423_report.html" -fp = open (Report_file,"WB") -Runner = Htmltestrunner.htmltestrunner (st
driver file named "Geckodriver.exe", and after downloading its path is configured in the PATH variable. or copy the file directly to the Python installation directoryDownload path for Geckodriver.exe: https://github.com/mozilla/geckodriver/releasesRe-run, you can implement the code!!!!Into the pit one: Forget the python installation pathWorkaround: Open Our cmd command to enter Python, enter the import sys, and enter the fourth in the print (Sys.path) list will be your installation pathInto the
1. Start by writing code, install Eclipse, website download software, https://www.eclipse.org/downloads/, remember first install Java, the proposal installs JDK1.7 above.
2. The next need to write selenium's code,testng code, from selenium, Selenium-server-standalone-2.41.0.jar,testng,testng-6.8.jar website Download the corresponding jar file, put into Eclipse's directory.
4. Next you can write
1. From write code start, install Eclipse, official website download software, https://www.eclipse.org/downloads/, remember to install Java First, the proposal installs JDK1.7 above.
2. Next you need to write selenium's code,testng code, from selenium, Selenium-server-standalone-2.41.0.jar,testng,testng-6.8.jar download the appropriate jar file and put it in the Eclipse directory.
4. Next you can write
(i) Test Suite test SuiteA test suite is a collection of multiple tests or test cases, a set of tests that are created for the corresponding functions and modules of the program under test, and the test cases within a suite of tes
(Str.substring (6)));} }So 1 off 2, 2 off 3 3 for the specific model-based reading of the class, so that the problem of element lookup solved2. Command: The simplest and most foolish way to command is to design the command after the if else if time reason I do the same 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0009.gif "alt= "J_0009.gif"/>This is the core of the foundation! The packaging of the interface is also very time consuming. The above for everyone to share it!This article
Firefoxdriver (); Driver.manage (). window (). Maximize (); Open Open Source China Web site public static void Navigate () {driver.get ("http://www.oschina.net/");} Click Login public static void Login_click () {driver.findelement (By.xpath ("//*[@id = ' Osc_userbar ']/a[1]"). Click (); Enter the user name public static void Input_name () {driver.findelement (By.xpath ("//*[@id = ' f_email ']"). SendKeys ("Xxxxxxa");} Enter the password public static void Input_password () {driver.findelement (
I pure wild Test ape One, did a year web function test, test a year set-top box, or want to do back to the old bank, self-study for a period of time selenium, learning process, encountered the need to enter the Web page verification code problems, online access to information, According to gourd painting Scoop (level L
1. Create two inheritance classes under the same package: 2. The code implementation in the class is: Package org. codeinfo. Demo; Import java. util. Concurrent. timeunit; Import org. openqa. Selenium.;Import org. openqa. Selenium. WebDriver;Import org. openqa. Selenium. Firefox. firefoxdriver; Public class utils {WebDriver driver = new firefoxdriver ();Pu
Add trigger, send a message when the build fails or is unstable, and will not send any messages if no trigger is added
The above Jenkins configuration is complete.
Then implement the Selenium test case installed on Linux that Jenkins can perform under Windows
A. Windows node that configures Jenkins
1. Click on the left panel:
Management node, System management
2. Click on the left panel: new node
3, en
print >>sys.stderr, ' \ntimeElapsed:%s '% (self.stoptime-self.starttime), can be changed to print (Sys.stderr, ' \ntime Elapsed:%s '% ( Self.stoptime-self.starttime)) Save the htmltestrunner.py after each modification. In addition, in 3, open the local file requires FP =open (filename, ' WB '), do not use file again; Fp.close () Closed2. Verify that you added the successImporting htmltestrunner.py packages in Python interactive mode>>import Htmltestrunner>>Add success when the above message app
for the function, because the implementation of the function requires a browser-driven driver,driver needs to be given by a specific invocation of the use case.test_case.py,test_case.py by invoking Login, Exit function for modularity#coding =utf-8from Selenium import webdriverfrom public import Loginimport unittestclass logintest (unittest. TestCase): def setUp (self): self.driver = Webdriver. Firefox () self.base_url = "http://www.
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.