simian automation

Alibabacloud.com offers a wide variety of articles about simian automation, easily find your simian automation information here online.

Python interface Automation 3-Auto Post (session) "Reprint"

# Coding:utf-8Import requests# Open the Login first page to get some cookiesurl = "Https://passport.cnblogs.com/user/signin"headers = {"User-agent": "mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) gecko/20100101 firefox/44.0 "} # Get method add a ser-agent to it.s = requests.session ()r = S.get (URL, headers=headers,verify=false)Print S.cookies# Two cookies required to add a loginc = Requests.cookies.RequestsCookieJar ()C.set ('. Cnblogscookie ', ' Here is caught ') # fill up the contents of the

Python interface automation 5-json data processing

|| +---------------+-------------------+| | string | Unicode || +---------------+-------------------+| | Number (int) | int, Long || +---------------+-------------------+| | Number (real) | float || +---------------+-------------------+| | true | True || +---------------+-------------------+| | False | False || +---------------+-------------------+| | null | None || +---------------+-------------------+Four, case analysis1. For example, open the Express network: http://www.kuaidi.com/, search f

Selenium2+python Automation 30-Introduction of the UnitTest framework "reprint"

= TrueClose the warning and to get the processing of the text box, if Judgment statement has been used many times, is not unfamiliar; try....finally To PythonException handling.def tearDown (self):Self.driver.quit ()Self.assertequal ([], self.verificationerrors)The TearDown method is called after each test method executes, and this place does all the cleanup work done by the test cases, such as exitingBrowser and so on.Self.assertequal ([], self.verificationerrors)This is a difficult point to c

Selenium2+python Automation 25-js Working with calendar controls (modifying ReadOnly properties)

up the Calendar control, casually click on the other location is good, next will use the JS method in the date, will not play!Five, JS method input Date1. You can also use the JS method to enter the date, in fact, it is very simple, directly change the value of the input box element can beSix, the reference code is as follows:# Coding:utf-8From selenium import WebdriverDriver = Webdriver. Firefox ()Driver.get ("Https://kyfw.12306.cn/otn/index/init")# Remove the ReadOnly attribute of the element

Python full stack development devops Automation direction first to advanced online course sharing

management SystemSupports Ansibleplaybook and ansible command script management. Support classification management, authorization, parameter registration, host index display, optional host profile, foreground execution, background execution, color scheme of execution result3 User Rights Management system4cmdb systemSupport host, app, domain name, HTTPS interface, whitelist, information management of computer room, support synchronizing host information from Jumpserver, support Resfulapi interfa

Python's Automation module installation

The operating system used previously was CentOS, and today's operating system is Debian, so start adapting and changing.Debian installation found that SSH is not installed by default, so install SSH service first and startApt-get Install ssh/etc/init.d/ssh StartNext, install the Pexpect,paramiko module.To install the above module, first install the setuptools module. Installing the setuptools module Wget tar xf setuptools-3.3.tar.gzcd setuptools-3.3python setup.py buildpython setup

"Selenium2 Python Automation Test" (13)--Upload file

Look at the code:# Coding:utf-8 fromSeleniumImportWebdriver fromTimeImportSleepdriver = Webdriver. Firefox () Driver.get ("Https://www.cnblogs.com") Driver.add_cookie ({' name ':'. Cnblogscookie ',' value ':' f956f323dfa5c31be489c0730c7d891 ',' domain ':'. cnblogs.com '}) Driver.add_cookie ({' name ':'. Cnblogs.AspNetCore.Cookies ',' value ':' CFDJ8NJXDYN1379IVW ',' domain ':'. cnblogs.com '}) Sleep (2) Driver.refresh () Driver.find_element_by_xpath (".//*[@id = ' span_userinfo ']/a[1]"). Click

A concise demonstration of Python selenium automation

1.selenium Installation:Pip Install-u SeleniumReference: Https://pypi.python.org/pypi/selenium#downloads2. Download the Firefox driver:Https://github.com/mozilla/geckodriver/releases3. Configure the directory where the Geckodriver.exe is located to the PATH environment variable4. A simple example:1 from Import Webdriver 2 3 driver=webdriver. Firefox ()45 driver.get ("http://www.sogou.com") # The end of the program will automatically open Firefox browser and open Sogou webpage1 fromSeleniumImpo

Selenium2+python Automation 45-18 Positioning methods (find_elements) "Reprint"

the same element on a page, then the parent element's properties are also blurred and not well positioned.This time do not be afraid, change a thought, do not always think of a positioning, you can first find the same attributes of the elements, take corresponding to the first few on it.3. For example, Baidu page has six class-like elements, I want to locate the "map" this element4. Take the corresponding subscript to locate theIv. Reference Code# Coding:utf-8From selenium import WebdriverDrive

Selenium2+python Automation 49-Judging text (text_to_be_present_in_element) "Reprint"

expected_conditions as ECDriver = Webdriver. Firefox ()url = "Https://www.baidu.com"Driver.get (URL)Locator = ("name", "Tj_trnuomi")Text = u "glutinous rice"result = Ec.text_to_be_present_in_element (locator, text) (driver)Print result# QQ Group: 232607095# Below is a case of failureText1 = u "Sticky rice net"RESULT1 = ec.text_to_be_present_in_element (Locator, Text1) (driver)Print RESULT1Locator2 = ("id", "su")Text2 = u "Baidu a bit"RESULT2 = Ec.text_to_be_present_in_element_value (Locator2, T

Selenium2+python Automation-Window multi-label processing method Summary (reprint)

(handle)Driver.find_element_by_link_text ("Baidu homepage"). Click ()The last sentence click on the "Baidu Home" link on the new tab to successfully represent the successful switch tag.2. Use JS to clear the target valueTo view the hyperlink with the F12 tool, you can see that there is a target property:Target=_blank means to open the linked document in a new window (quoted from W3school), the popular point is that the hyperlink will be opened with a new window (new tab), then the value will be

Selenium2+python Automation 16-alert\confirm\prompt "Reprint"

possible)2. Analysis reason: After slowly debugging found, when the "Save Settings" button, because of the previous select operation, lost focus3. Workaround: After the select operation, do a click () operations = driver.find_element_by_id ("NR")Select (s). Select_by_visible_text ("Show 20 per page")Time.sleep (3)S.click ()VI. Final code# Coding:utf-8From selenium import WebdriverFrom Selenium.webdriver.common.action_chains import ActionchainsFrom Selenium.webdriver.support.select Import Select

Selenium2+python Automation 60-screenshot after exception (screenshot) "Reprint"

account password, let the correct operation to assert this step, the assertion is deliberately set to false unsuccessful"Tryself.driver.find_element_by_id ("Input1"). Send_keys (U "Shanghai-leisurely")self.driver.find_element_by_id ("Input2"). Send_keys ("xxx")# login ID is wrong, positioning will throw exceptionself.driver.find_element_by_id ("Signin"). Click ()# Determine if the Login Success page has an account: "Shanghai-leisurely"Time.sleep (3)Locator = ("id", "lnk_current_user")result = E

Web Automation Test-d4-One of the Learning notes (NPX)

Install the node8.x version and install the following two commands to install Uirecorder node:https://nodejs.org/en/download/npm install-g cnpm--registry=https:// registry.npm.taobao.org cnpm Install uirecorder mocha–g uirecorder Test command Uirecorder--version the Uirecorder logo is installed successfully. (Note: Refer to the bloghttp://www.imdsx.cn/index.php/2017/11/10/uirecorder/ installation is also possible) Open cmd into the folder directory you created, I created: E:\Uirecorder-1Enter Ui

Selenium2+python Automation 67-use case failure automatic screenshot "reprint"

)"Return Wrapped_f@decoratorWithArguments ("Hello", "World", 42)Def SayHello (A1, A2, A3, A4):print ' SayHello arguments: ', A1, A2, A3, A4Three, the decoration device1. With the reference document above, according to the gourd painting scoop, the biggest trouble is driver parameter processing, here put in the __init__ can beIv. Reference Cases# Coding:utf-8From selenium import WebdriverClass screen (object):U ' ' This should function as an adorner 'def __init__ (self, driver):Self.driver = Driv

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

Selenium2+python Automation 73-Positioned Pit: Class attribute has a space "reprint"

) to locate, the positioning method is flexibleSeven, reference code# Coding:utf-8From selenium import WebdriverDriver = Webdriver. Firefox ()Driver.get ("http://mail.126.com/")Driver.implicitly_wait (20)Driver.switch_to.frame ("X-urs-iframe")# method One: Take a single class attributeDriver.find_element_by_class_name ("Dlemail"). Send_keys ("Yoyo")Driver.find_element_by_class_name ("Dlpwd"). Send_keys ("12333")# method Two: Positioning a group to remove the target location (it is the worst way)

Selenium + Python deployment automation test environment

command "Easy_install pip", wait for the installation to complete 5. Install the Python-based Selenium installation package, cmd window into the Python installation directory to execute the command "Pip install Selenium", waiting for the installation to complete; 6. Download Firefox plugin, see annex 2Selenium_python_firefox.rarInput code: From selenium import webdriverdriver=webdriver. Chrome () driver.get ("http://www.baidu.com") pop-up browser, and enter the Baidu interface, to prove the suc

Watir-webdriver Automation test scheme based on Ruby

endend Control layerInvolves dependencies:' linux.rb ' 'mysql.rb'The specific implementation needs to be discussed with Tianlirong to discuss the testability of the specific business logic.Tools Tool ClassInvolves dependencies:' Net/ssh ' 'scp/ssh'"test/unit"Associating Linux#ip/user name/passwordHost="192.168.48.233"username="Root"Password="Root"#calling the Linux commandserver_cmd1='Tail-1000/home/log/web.log | grep ERROR'Server_shell='sh/home/wyong/w.sh'Associated MySQLSpecific

Python Automation Development Learning 12-Bastion Machine development

, default 22 Host authentication table (and host table many-to-many associations): ID name User name Password Self-Increment ID Comment Name User name A string of clear text Host group table (and host table + host authentication table Many-to-many association):The previous combination tables are combined with 2 tables, which are combined with 3 tables.Because different groups may contain the same machine,

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.