Alibabacloud.com offers a wide variety of articles about selenium webdriver python documentation, easily find your selenium webdriver python documentation information here online.
Selenium Webdriver launches three major browsers Firefox,chrome,ie1. Installing SeleniumIn the case of networking, you can install selenium automatically by entering Pip install Selenium on the Windows command Line (CMD), and after the installation is complete, enter PIP show selen
Original address: Http://www.seleniumhq.org/docs/03_webdriver.jsp#selenium-webdriver-api-commands-and-operations
(This article is only for the Python part of the translation)
First of all, I have a point: my English is very poor, so this translation is only used to understand more deeply the use of webdriver.
First, ge
(text(), ‘%s‘)]/following-sibling::*" % u"新闻")Locate all of its sibling nodes via the "News" node just now.The Python Selenium code snippet is as follows (note that Find_==elements==_by_xpath is used here):driver.find_elements_by_xpath(u"//div/a[contains(text(), ‘%s‘)]/following-sibling::*" % u"新闻")Let's look at a complete code example:#_ *_ Coding:utf-8 _*___author__ =' Bitter leaves 'From seleniumImport W
(' content ')def crawl (URL): driver = webdriver. Chrome () driver.get (URL) driver.switch_to.frame (' content ') page = 0 lst=[] with open ('./ Url.txt ', ' a ') as F: While page At this point, run into:refer to the post link: http://unclechen.github.io/2016/12/11/python%E5%88%A9%E7%94%A8beautifulsoup+selenium%E8%87%AA%E5%8A%A8%E7% bf%b
geckodriver.exe into the Python installation directory is installed in the D:/python is placed in the D:/python directory can beThen run the code again just to be successful here to make sure your Firefox browser is the latest version if there should be no error messageThere's a robot avatar next to the browser, which means the program is under surveillance, the
://chromedriver.storage.googleapis.com/index.html
The version and the version of Chrome that were supported by the previous versions are described in Notes.txt in each of these editions, but the old driver has already compiled a glance form for you:
Selenium's chromedriver and chrome version mapping table
In this way, it is not clear which version of Chrome and chromedriver should be downloaded.4. All versions selenium and iedrivers
__init__(Self, func): Self.func=funcdef __get__(self, obj, CLS):ifObj isNone:returnSelf value=self.func (obj) setattr (CLS, Self.func.__name__, value)returnvalueclassdriverwrapper ():"""1, based on the selenium two-time package, 2, support unlimited instantiation of this class, still maintain the use of the same browser window. 3. Support the use of custom method names, while direct support uses all methods not defined in this class, but has API m
V31-34
v2.8
V30-33
v2.7
V30-33
v2.6
V29-32
v2.5
V29-32
v2.4
V29-32
Click here to download Chrome's webdriver:http://chromedriver.storage.googleapis.com/index.htmlFirefoxthe Firefox driver is: https://github.com/mozilla/geckodriver/releases/depending on your operating system to download the corresponding driver, if used, you need to add the path of the drive and the path of Firefox browse
Preliminary impressions of the Python webdriver automated test The following example demonstrates starting Firefox, browsing google.com, searching for cheese, waiting for search results, and then printing out the title of the search results page From selenium import webdriver from selenium.common.exceptions import time
the page. Use the PIL Image module to capture a specific area. The Code is as follows:
Train of Thought: Save the web program --> locate the verification code coordinate --> locate the verification code from it
From PIL import Imageimport pytesseractfrom selenium import webdriverurl = 'HTTP: // xxxxx.com 'driver = webdriver. chrome () driver. maximize_window () # maximize the driver for the browser. get (u
api:http://phantomjs.org/api/.PHANTOMJS Official example: http://phantomjs.org/examples/.Phantomjs github:https://github.com/ariya/phantomjs/.Iv. installation of PHANTOMJSI windowns7 the system, the downloaded phantomjs.exe moved to your Python folder under the script can be used. (Download Phantomjs-2.1.1-windowns.zip Link: http://pan.baidu.com/s/1c8HeBc password:2zm4)Small test:1 From Selenium import
Introduction
There are often children's shoes asking such questions:1. Where can i download chromedriver?2, why do I have a good chromedriver but Chrome won't start?Solution Solutions
Today we are going to solve them.1, chromedriver official website: http://chromedriver.storage.googleapis.com/index.htmlHere are all the versions, click on a version of the directory can see the detailed content, suffix Win32 is under Windows, suffix MAC64 is the Mac2, why do I have a good chromedriver but Chro
/.
Official PhantomJS API: http://phantomjs.org/api /.
Official PhantomJS example: http://phantomjs.org/examples /.
PhantomJS GitHub: https://github.com/ariya/phantomjs /.4. Install PhantomJS
In the Windows 7 system, move the downloaded phantomjs.exe file to the Script in your python folder. (Download phantomjs-2.1.1-windowns.zip link: http://pan.baidu.com/s/1c8HeBc password: 2zm4)
Small test:
1 from selenium
In Windows cmd execute "python test.py", no problem, the browser open normally, the test results are normal.Problem:But if it is in Jenkins, choose "Execute Windows Batch command", configure "Python test.py" run test, this time there will be a problem, Chrome browser will not open, but there are processes in the background, Test.py runs in the background, but runs test.py in the background and the browser d
DRIVER: phantomjs
Note: Some browser driver addresses require scientific Internet access.
Set browser driver
Setting the browser address is very simple. You can manually create a directory to store the browser driver, such as C: \ driver, and drop the downloaded browser driver files (such as chromedriver and geckodriver) to this directory.
My computer-> properties-> system settings-> advanced-> environment variables-> system variables-> Path, add the "C: \ driver" directory to the Path value.
, including compilation, release, and automated testing, to identify integration errors early.Eight, automated testing is not the need to connect to the database to do data validation?1 UI Automation does not require2 Interface testing will requireNine, Id,name,class,xpath, CSS selector these attributes, which one do you prefer, and why?1.CSS, CSS syntax concise, fast positioning (XPath syntax long, positioning slow, not stable)X. How to locate dynamically loaded elements on a page?1. The webdri
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.