1.Python Download and install ?Go to the Python website first download the installation package:http://www.python.org/After downloading, follow the steps to install (preferably do not install to the system disk)Add the installation path (Python and scripts) to the system environment variables: computer--Properties--Advanced system settings, System variable path2
Ubuntu python3.41. Install Selenium, PIP installationPip Install Selenium2.selenium version 2.53.xTry to download the selenium3 from the official website, but firefox to install the new geckodriver, the change back to 2.53.x.The next study will be supplemented.3. Start the sample exerciseA QQ Mailbox Login program was tested:#-*-coding:utf-8-*- fromSeleniumImportWebdriver fromSelenium.webdriver.common.keysI
driver.find_element_by_css_selector (' div#d + div '). Text
# 5.CSS Selector ~
print driver.find_element_by_css_selector (' div#d ~ div '). Text
driver.quit ()
Results:
Brother 2Brother 2Brother 2Brother 2Brother 2
Bloggers have shared five ways to locate their younger siblings, the top three of which are in XPath, the first is well understood, and the second uses the XPath axis: following-sibling, similar to preceding-sibling, is used to get all sibling siblings of the current node, Sim
Since 2016 know Python, will only use Telnet or SSH to operate the network device implementation of automatic command, the Web interface of the device basically helpless, until recently job-hopping company is all convinced that the service equipment, the background is ssh, sorry, not open to customers, SNMP OIDs only provide so few, to bulk operation, deep convincing advice is to buy the central manager, unified device version, I go nm ... Later found
First, install Python, configure environment variables (configure system environment variables according to Python installation path), I was installed in (E:\PYTHON27)Second, download the PY stuptools Toolkit--url: https://pypi.python.org/packages/2.7/s/setuptools/ Setuptools-0.6c11.win32-py2.7.exe and self-installing Third, download Pip https://pypi.python.org/pypi/pipAfter installing the
Stand on the shoulders of friends to learn!!!Prerequisite: The python environment has been built1. Installing SeleniumCommand line Input "pip install Selenium" one-click Installation2. Check if the selenium is installed successfullyUse the command "Pip show Selenium" to see the version information that is installed on
About JenkinsJenkins is a very popular continuous integration (CI) service written in Java, originating from the Hudson project. So Jenkins and Hudson function similarly.Jenkins supports various versions of control tools, such as CVS, SVN, Git, Mercurial, perforce, and ClearCase, and can execute projects built with Apache Ant or Java maven. It can also use plug-ins, shell scripts, and Windows batch commands to build projects on other platforms.In addition to building software functions, Jenkins
()
driver.implicitly_wait (10) # Implicit wait and explicit wait can be used at the same time, but note that the longest wait time is the greater of
driver.get (‘https://xuehu365.com’)
locator = (By.LINK_TEXT, ‘CSDN’)
try:
WebDriverWait (driver, 20, 0.5) .until (EC.presence_of_element_located (locator))
print driver.find_element_by_link_text (‘CSDN’). get_attribute (‘href‘)
finally:
driver.close ()
In the example above, we set the implicit wait and explicit wait, in other operations, the
elementFind_element_by_partial_link_text (Link_text) find_elements_by_partial_link_text (Link_text)#Find part of a link to an element of textFind_element_by_tag_name (name) find_elements_by_tag_name (name)#Find the label name of an elementFind_element_by_xpath (XPath)#Find XPath for an element Find_elements_by_xpath (XPath) # find child elements within an element Xpath Find_element_by_class_name (name) # Find the class name of an element find_elements_by_ Class_name (name) # Find the class na
Python-selenium 2 Upgrade to the latest versionSelenium 2.48 was used before. firefox36The actual user's browser may have an automatic Update feature, so the version is basically up-to-date. So this time specifically to do a browser upgrade and selenium upgrade.Since Webdriver 3.0, selenium no longer provides default b
First open the command line and enter in the DOS window:
1
python -m pydoc -p4567
Simply explain:
Python-m Pydoc means to open the Pydoc module, Pydoc is the preferred tool for viewing Python documents;
-p 4567 means start the server on port 4567;
Then access http://localhost:4567/in the browser, and you should see al
Do automation also a long time, this period of time the project early on nothing to do in the review before the seleniu+python of knowledge, now want to do a simple record, but also for their own learning has a driving effect bar.Above.First, Python:https://www.python.org/There is not much comment on the choice of Python version, but it is recommended that you use the 3.x version.Follow the instructions in
SceneThe positioning and operation of the test object is the core content of Webdriver, and the operation is based on the positioning, so the object positioning becomes more and more important.The purpose of locating objects generally has the following types of
Manipulating objects
Gets the properties of the object, such as the class property of the test object, the Name property, and so on
Gets the text of the object
Get the number of objects
Webdriver provides a serie
1. Install Pythonhttps://www.python.org/2, install setuptools(Python's basic Package tool):https://pypi.python.org/pypi/setuptoolsDownload ez_setup.py fileOpen cmd, go to the directory where the ez_setup.py file is stored, execute the python ez_setup.py3. Install pip(Python's installation package management tool):https://pypi.python.org/pypi/pip, download pip-6.1.1.tar.gzCMD into the file directory after decompression, execute
Python is a 3.5,chrome browser version in early 17.1.chromedriverDownload a chromedriver in http://chromedriver.storage.googleapis.com/index.html?path=2.30/, unzip the exe paste into the chrome installation path, Generally in program Files (x86) \google\chrome\application2. Installing the Selenium LibraryOpen the console and enter the command: Pip install SeleniumIf PIP is not installed, then search keyword
Python + Selenium notes (9): Operation warning and pop-up box, pythonselenium
(1)Preface
Developers use JavaScript warnings or modal dialogs to prompt for verification error information, alarm information, returned information after the operation is executed, and even to receive input values.
(2)AlertClass
Selenium WebDriver uses the Alert class to manipulate Jav
compatibility.2. First use Driver.name to get the browser name, and then use the IF statement to make a judgmentVII. Compatibility1. Compatible with Google and firefox/ieEight, the reference code is as follows:# Coding:utf-8From selenium import WebdriverDriver = Webdriver. Firefox ()Driver.get ("https://www.baidu.com")Print Driver.name# Back to the topDef scroll_top ():if driver.name = = "Chrome":JS = "var q=document.body.scrolltop=0"ElseJS = "var q=
, execute PIP (error to see if the path is correct)E. Configuring the PIP environment variable1. Add Environment variables:2. Add the System environment variable path:4. Install Selenium (install with PIP)Execute pip install selenium==2.53.6 under cmd*. To install additional third-party libraries, you can also use the PIP installation format: Pip install third-party library name (equal sign = indicates the
Because of the project, more recently used UFT to automate the test work, six months did not use selenium, so on their own computer reconfiguration of the selenium environment based on python3.x, the configuration process is generally as follows:1. Selenium InstallationSelenium the environment configuration under Python
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.