Read about automation test plan for selenium, The latest news, videos, and discussion topics about automation test plan for selenium from alibabacloud.com
Techniques used: POI parsing of Excel, selenium automated testing, JUnitTest Case: Login www.1905.com Perform login-exit operationTo perform the steps:1, first create an Excel, there is a user name and password column2. Create a new Java class to parse Excel PackageCom.m1905.java;ImportJava.io.FileInputStream;Importjava.io.FileNotFoundException;Importjava.io.IOException;ImportJava.io.InputStream;Importjava.util.ArrayList;Importjava.util.List;ImportOrg
I. OverviewIn the use of automation framework selenium implementation, often encounter Windows pop-up box appears, just get started web automation test small partners don't panic Oh!Two. Several common scenarios for handling Windows pop-up boxes2.1 Selenium Handling Security
ifrome1 (id = f1) browser.switch_to_frame ("F1 ") # Then find the ifrome2 below it (ID =f2) browser.switch_to_frame ( "f2) # Below you can manipulate elements browser.find_element_by_id (" kw" selenium ") browser.find_element _by_id ( "su" ). Click () time.sleep (3 Browser.quit () Driver.switch_to_window ()It is possible to nest not frames, but windows, and true-to-window methods: Switch_to_windowUsage is the same as Switch_to_frame:Driver.swit
": - Wuyi Print("QQ Exchange Group: 226296743") the - Print(Is_result_pass ()) Wu -```Operation Result:```The test process has not passed the use case: Pass 2 Failure 1 Error 1False```2. Add a judgment before the last email```1 if notIs_result_pass ():2 3 #determine if the HTML report has an error4 5 6 7 #execute the Send mail function, write your own e-mail function8 9 #send_mail (sender, PSW, receiver, Smt
Selenium official websitehttp://selenium-python.readthedocs.io/Configuring the Usage environmentDownload the appropriate browser driver, Firefox is the defaultThis article is based on Chrome, placed in the scripts directoryChromedriver official: All versions of ChromedriverDocument referenceA Concise Python tutorialPython Tutorial-LiaocheOfficial document: Selenium
failure case # coding:utf-8from bs4 import BeautifulSoupimport sysreload(sys)sys.setdefaultencoding('utf8')def is_result_pass(): try: with open("result.html", "r") as fp: f = fp.read() # 读报告 soup = BeautifulSoup(f, "html.parser") status = soup.find_all(class_="attribute") result = status[2].contents[-1] # 获取报告结果 if "Failure" in result or "Error" in result: print("测试过程有不通过用例:%s"%result) return False else: r
positioning of the page, and the method encapsulated by the business operation code associated with those elements.4. Code reuse, which reduces the amount of test script code.5. Clear hierarchy, while supporting the development of multiple writing automation scripts, such as how many pages each person writes, does not affect others.6. It is recommended that both the page class and the business logic approa
In the earliest contact with selenium, think can write the basic script in Java, can run, such as the following a section of the positioning element script1 driver.findelement (by.id ("name")). Click (); 2 driver.findelement (By.xpath ("//input[contains (@data-value, ' sort ')]"). Click;Seeing the above script, we can encapsulate a method separately, using the code to improve the simplicity, so we can customize a method Locatedrivereleso we can improv
input box, the data is passed into Send_keys (Hzy). This is called by loop until all the contents of the file are read.Second, login parameterizationNow according to the above ideas, the Automation script user, the name of the password parameterized, through the Python document we found that Python read the file: The entire file read, read-line, fixed byte read.Did not find a good way to read two data at a time.Create two files, each of which holds t
Hantomjs") Driver=Webdriver. PHANTOMJS ()returnDriverElse: Print("Not found this browser,you can use ' Firefox ', ' Chrome ', ' ie ' or ' phantomjs '") exceptException as msg:Print("The exception occurred when starting the browser:%s"%str (msg))Multithreading launches different browsers1. Code reference:#Coding:utf-8 fromSeleniumImportWebdriverImport Time fromTomorrowImportThreadsdefStartbrowser (name):"""Open Browser functions, "Firefox", "Chrome", "ie", "PHANTOMJS"""" Try:
secondiframe = Driver.find_elements_by_tag_name (' iframe ') [1]# Switch to the IFRAMEDriver.switch_to_frame (IFRAME)# Click to open the File upload buttonDriver.find_element_by_name (' file '). Click ()Time.sleep (3)# Execute AutoIt Upload filePrint IOs.system ("C:\Users\Gloria\Desktop\cmdjpg.exe%s"% i) # your own local. exe pathTime.sleep (3)Driver.switch_to_default_content () # cut back to the main page# # Method Two: Cycle Click Upload Image# for I in range (4):# # 1 O'Clock Open editor pic
file to upload the path of the file to write dead, each time can only pass the fixed image, we actually test when we want to pass a different picture, so you need to parameterize the file path.To parameterize the passed-in parameters, you can pass the AutoIt command-line arguments: is a string parameter” 99In the script, command-line arguments can be obtained using the following variables:$CmdLine[0] ; = 3$CmdLine[1] ; = param1$CmdLine[2] ; = "Thi
Finally, I stepped into the path of learning automation. Originally is to exclude the code, but did not think really seriously to learn the time, found that he is interesting, finished homework feel good to have a sense of accomplishment. Learning process, also encountered a lot of problems, try to find a solution to the problem, can not find a solution, there are colleagues to ask. This kind of learning opportunity, very rare AH.Have now learned the
1. The entire framework directory is as follows:Constant: Store some constants, such as the URL of the test, and the elements that some PR methods need to use;Errorpicture: Used to store errors during automatic operation;Framework: Classes and methods for storing some basic;Pages: a page class for storing pageobject;Publicmethod: Used to store some PR methods;Question: Used to store some problems encountered during the development process, and where t
ObjectiveSELENIUM+PHANTOMJS can open the browser without interface, implement the silent mode to start the browser to complete the automated test, this mode is excellent, do not need to occupy the computer screen.However, phantomjs this hole is still more, and encountered problems can not see the page, unable to troubleshoot problems.In fact, the Chrome browser can also implement silent mode, do not display the page on the computer, can also implement
) to locate the child element, which is the XPath The wording is very different, in fact, very good understanding, direct translation came to the first few childrenSix, CSS: Logical Operations1.css can also implement a logical operation, matching two properties, which is not the same as XPath, no need to write the and keywordSeven, CSS: Fuzzy Matching1.css Fuzzy matching contains (' xxx '), although the Internet with a variety of data display can be used, but the small part of the
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.