python gui automation

Learn about python gui automation, we have the largest and most updated python gui automation information on alibabacloud.com

Senior programmers use Python for data-driven interface automation testing!

2. The programmeFor the above API, when doing interface testing, the test cases need to be up to 10 +, this time in a data-driven way to write the common content of the configuration file may be more appropriate.Here consider the API, parameters, and expected results preprint in the formatted CSV, using the CSV component to read the URL, parameters, and expected results from the CSV, requests component initiates the request, compare the response result with the expected result, and then write th

Selenium2+python Automation 55-unittest (@classmethod)

)@classmethoddef teardownclass (CLS):Cls.driver.quit ()def test_01 (self):U ' validation element exists: Blog Park 'Locator = ("id", "blog_nav_sitehome")Text = u "Blog Park"result = Ec.text_to_be_present_in_element (locator, text) (Self.driver)Self.asserttrue (Result)def test_02 (self):U ' validation element exists: Home 'Locator = ("id", "blog_nav_myhome")Text = u "Home"result = Ec.text_to_be_present_in_element (locator, text) (Self.driver)Self.asserttrue (Result)if __name__ = = "__main__":Unit

Selenium2+python Automation 38-Explicit Wait (webdriverwait)

"). Is_displayed ())"""Self._driver = DriverSelf._timeout = TimeoutSelf._poll = poll_frequency# avoid the divide by zeroIf Self._poll = = 0:Self._poll = poll_frequencyexceptions = List (ignored_exceptions)If Ignored_exceptions is not None:TryExceptions.extend (ITER (ignored_exceptions))Except TypeError: # ignored_exceptions is not iterableExceptions.append (ignored_exceptions)Self._ignored_exceptions = tuple (exceptions)def __repr__ (self):Return ' Type (self), self._driver.session_id)def until

Python writes automation constructs Multipartform-data sends the request

= encode_multipart_formdata ("Data ", fields) req = Urllib2. Request (URL, body) req.add_header ("User-agent", "mozilla/5.0" (Windows NT 6.1; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/31.0.1650.63 safari/537.36 SE 2.X METASR 1.0) ") Req.add_header (" Accept "," */* ") Req.add_header (" Accept-language "," zh-cn,zh;q=0.8 ") Req.add_header (" Accept-encoding "," GZIP,DEFL Ate,sdch ") Req.add_header (" Connection "," Keep-alive ") Req.add_header (" Content-type ", Content_Type) Req.add_

Selenium2+python Automation 22-Send various types of attachments mail "reprint"

JPG)Part = mimeapplication (open (' d:\\tyrone.jpg ', ' RB '). Read ())Part.add_header (' content-disposition ', ' attachment ', filename= "tyrone.jpg")Msg.attach (part)PDF Type AttachmentsPart = mimeapplication (open (' d:\\tyrone.pdf ', ' RB '). Read ())Part.add_header (' content-disposition ', ' attachment ', filename= "Tyrone.pdf")Msg.attach (part)MP3 Type attachmentPart = mimeapplication (open (' D:\\tyrone.mp3 ', ' RB '). Read ())Part.add_header (' content-disposition ', ' attachment ', f

Selenium2+python Automation 17-js Handling scrollbars

= webdriver. Firefox () Driver.get ("https://www.baidu.com") Print Driver.name # # back to top #def scroll_top (): # if Driver.name = = "Chrome": # js = "var q=document.body.scrolltop=0" # else: # js = "var q= Document.documentelement.scrolltop=0 " # return Driver.execute_script (JS) # pull to bottom #def scroll_foot (): # If driver.name = = "Chrome": # JS = "var q=document.body.scrolltop=10000" # else: # js = "var q=document.documentelement.scrolltop=10000" # return Drive

Python Automation Development Learning 3

is processed" return f (x, y) A = Fxy (3,6,min) # min is a built-in function, the minimum value B = Fxy (3,6,max) # Max is a built-in function that asks for the maximum value C = Fxy (3,6,POW) # POW is a built-in function, exponentiation. 3 of the 6-time Square is 729print (a,b,c)HomeworkPayroll Management SystemAlex 100000Rain 80000Egon 50000Yuan 30000-----above are info.txt file-----Implementation results:Read employees and their payroll information from the Info.txt file, and finally write t

Selenium2+python Automation 55-unittest Decoration (@classmethod) "Reprint"

)@classmethoddef teardownclass (CLS):Cls.driver.quit ()def test_01 (self):U ' validation element exists: Blog Park 'Locator = ("id", "blog_nav_sitehome")Text = u "Blog Park"result = Ec.text_to_be_present_in_element (locator, text) (Self.driver)Self.asserttrue (Result)def test_02 (self):U ' validation element exists: Home 'Locator = ("id", "blog_nav_myhome")Text = u "Home"result = Ec.text_to_be_present_in_element (locator, text) (Self.driver)Self.asserttrue (Result)if __name__ = = "__main__":Unit

Selenium2+python Automation 37-Crawl page source code (PAGE_SOURCE) "Reprint"

ObjectiveSometimes it is not easy to find an element on the page by the attribute of the element, and you can crawl the information from the source. Selenium the Page_source method can get to the page source code.Selenium of the Page_source method is rarely used, small make a recent look API accidentally found this method, so the whim, here combined with the Python re module with regular expression crawled out of all the URL address on the page, can b

The tenth week of the Python Automation development Study----RabbitMQ

") channel.start_consuming ()Rpc_clientImport Pikaimport Uuidclass fibonaccirpcclient (object): Def __init__ (self): Self.connection = Pika. Blockingconnection (Pika. Connectionparameters (host= ' localhost ')) Self.channel = Self.connection.channel () result = SELF.C Hannel.queue_declare (exclusive=true) self.callback_queue = Result.method.queue Self.channel.basic_consume (SE Lf.on_response, No_ack=true, Queue=self.callback_queue) def on_response (self, CH, met Hod, props, body): if self

Jenkins automation launches Python flask simulation process

;650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/15/cbb03ec8132db827a35842ef02a80df4.png-wh_500x0-wm_3 -wmp_4-s_1885242868.png "title=" qq picture 20171115173648.png "alt=" Cbb03ec8132db827a35842ef02a80df4.png-wh_ "/>650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/15/4bb7474bbd70ba48509b097ced5cf0f8.png-wh_500x0-wm_3 -wmp_4-s_2741617620.png "title=" qq picture 20171115173648.png "alt=" 4bb7474bbd70ba48509b097ced5cf0f8.png-wh_ "/>4. System Management-System configuration65

Python Automation audit and implementation

assignment is placed in the variable argument list, and the specific process 3:In addition, in the process of analysis, the following conditions should be excluded to end the analysis ahead of time. The first case is that the IF statement has Os.path.exitst,isdigit with controllable parameters and contains a return statement, such as (if not os.path.isdir ( Parentpath):return None); The second case is to lock the controllable parameter in a certain value range and return it directly, as (if typ

Python interface test automation instructions and code examples: including GET, post, put, delete and other methods

------" data = Json.dumps ({"userid": 1, "token": "868d26e05666c5aaeb76d361faa7448c", "ArticleID": [3,4,5]}) # r = Requests.delete (' http://localhost:8080/delete/', data = data) Print R.status_code Print R.text Print type (R.json ()) Print str (R.json ()) DescriptionIf these interfaces are requested in some interface request plug-ins (such as Httprequester), there is no space between key-value pairs when the parameter is passed, and the string must be enclosed in do

Cloud computing Python Automation Operations Development: Interactive mode programming

!.Another way to execute a python script, modify the test.py file:#!/usr/bin/pythonPrint "Hello, python!"To run the program:chmod +x test.py#./test.pyHello, python!.Using Chinese in script mode programmingPython uses ASCII code by default, does not support Chinese, the Chinese language needs to be declared to support the Chinese character set, generally utf8, the

Using Python for report automation ~

Using Python for report automation ~This article will cover: XLWT Common functions XLRD Common functions Xlutils Common functions XLWT application of formulas when writing Excel XLWT writing to a specific directory (path setting) In the XLWT Python language, an extension tool that writes to an Excel file. You can implement

Selenium3+python Automation 50-environment building (Firefox) "Reprint"

ObjectiveThere are a lot of small partners in the installation of selenium environment after the Firefox error, because now selenium upgrade to 3.0, and 2.0 of the version there is a little difference.There are three main pits encountered during the installation environment:1.' geckodriver ' executable needs to is in PATH2.expected browser binary location, but unable to find binary in default location3.unsupported Marionette Protocol version 2, required 3Environment Preparation:--python3.6--sele

Selenium2+python Automation 59-data-driven (DDT)

from the previous encapsulated Excel method, as test test Selenium2+python Automation 58-read Excel data (XLRD)2. Make some changes based on the previous written login, test parameters read the data in Excel Selenium2+python Automation 48-Login method (parametric)3. The code reference is as follows# test DataTestData

Python+selenium in the UI Automation test project, Common Tips 4: Log printing, longging module (console and file simultaneous output)

Fh.setformatter (Formatter) - Ch.setformatter (Formatter) - #Add handler to logger - Logger.addhandler (FH) - logger.addhandler (CH) - #record a log in ifLevel = ='Info': - logger.info (message) to elifLevel = ='Debug': + logger.debug (message) - elifLevel = ='Warning': the logger.warning (message) * elifLevel = ='Error': $ logger.error (message)Panax Notoginseng logger.removehandler (CH) - Logger.removehandler (FH) the + defDebug (self,messa

"Python automation Sixth article: Object-oriented"

in the world can be classified, and all things are objects. Just say: The object belongs to a certain kind of As long as the object, there must be attributes Second, Characteristics: Class: An abstraction, blueprint, and prototype of an object that has the same attributes as an alien. In this class, you define the properties and common methods that these objects have. Object object: An instance of a class that is instantiated after it has to be in

Python Learning Notes (interface Automation framework)

) - forIinchRange (0, nrows-1): theTestName =createexcel.get_name (table, nrows) [i] -TestData =createexcel.get_data (table, nrows) [i]WuyiTesturl =createexcel.get_url (table, nrows) [i] theTestMethod =Createexcel.get_method (table, nrows) [i] -Testpattern =Createexcel.get_pattern (table, nrows) [i] WuTestreport =createexcel.get_report (table, nrows) [i] - createtest.test_on () About Print "test Case:", TestName $ Try: -TestResults =Createtest.test_api (TestMetho

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.