Python + Selenium notes (2): configure the Google + IE environment and pythonselenium

Source: Internet
Author: User
Tags seleniumhq

Python + Selenium notes (2): configure the Google + IE environment and pythonselenium

 #Sometimes you may need to access a foreign website to download materials or tools. In this case, various problems may occur, such as Google's failure to display man-machine verification and Website access failure. We recommend that you use a FQ software.

Download the free version. Download and install it directly.

Http://www.softpedia.com/get/Internet/Servers/Proxy-Servers/Lantern.shtml

(1) set IE

(1) http://docs.seleniumhq.org/download/ download IEDriverServer. (We recommend that you download the 32-bit, 64-bit driver to execute send_keys very slowly. You can download them all)

 

 

(2) decompress the package to any directory and add the PATH to the PATH variable.

(3) In Internet Options, either the protection mode is enabled or none of the following four are enabled.

 

(4) IE is scaled to 100% by default (this step can be ignored if it is already 100%)

(5) Start IDE (if the IEDriverServer has been started before it is set, restart it)

(6) modify the code

Remove the following three lines from the previous article:

FromSelenium. webdriver. firefox. firefox_binaryImportFirefoxBinary

firefox = FirefoxBinary(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
driver = webdriver.Firefox(firefox_binary=firefox)

To:

driver = webdriver.Ie()

(7) For IE11, you need to go to the Registry (only for IE11, not for other versions)

HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_BFCACHE

Set the New DWORD name to iexplore.exe and set the value to 0.

For example, if FEATURE_BFCACHE cannot be found, a new item is created ):

 

(8) instructions in the official documents on the settings of the IE11 browser (poor English, good translation software, and even guesses)

Https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

 

(9) If it is WIN 10, set 100% as follows.

 

(10) When IE is started, the following prompt will pop up. Literally, this is not an error. It just means that the WebDriver server is started.

 

(2) Set Google

(1) download chromedriver from the http://docs.seleniumhq.org/download.

(2) decompress the package to any directory and add the PATH to the PATH variable.

(3) Start IDE (if it has been started before chromedriver is set, restart it)

(4) modify the code

Remove the following three lines from the previous article:

FromSelenium. webdriver. firefox. firefox_binaryImportFirefoxBinary

firefox = FirefoxBinary(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")
driver = webdriver.Firefox(firefox_binary=firefox)

To:

driver = webdriver.Chrome()

(3) personal opinions on automated testing

For example, using an automatic Harvester to harvest rice can also be done manually in a suitable environment (for example, on the plain), but using the automatic harvester has two advantages: 1. low cost. 2. high efficiency. However, in an unsuitable environment, for example, in some southern hill environments, automatic harvesters may not be able to work at all, or the cost is much higher than that of manual machines, or the efficiency is lower than that of manual machines. In my opinion, automated testing is to automate the appropriate work as appropriate. (Of course, unlike automatic harvesters and people, it may be that performance automation cannot be achieved by manual operations, such as concurrent users, large data volumes, and fatigue strength tests) I will talk about this here. Actually, I didn't say anything, haha!

Related Article

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.