# 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
= 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
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
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
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
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
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
(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
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
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
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
)"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
) 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)
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
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
, 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,
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.