Selenium_rc environment Configuration

Source: Internet
Author: User

In the previous article, I analyzed the automatic recording script of selenium ide. According to the previous two operations, it is obvious that the newly created test. py file cannot be run. The key issue is: 1. python is not installed; 2. selenium_rc is not installed.

For Python Installation Problems, go to www.python.org to download the Installation File (Windows Installer ). Remember, remember to go to. Org and. org. Of course, if you are 18 years old and. COM has a special liking and a strong curiosity and is not affected by contempt, you can also open it silently. org site, the advice is, please take an artistic eye to appreciate the problem and try to avoid appreciation of art at work or in public places.

Go to python.org (you know ...) To download a python2.7 Installation File. We do not recommend using python3.1, which is the best practice in the industry. Because python3 has changed some syntaxes, such as print () or raw_input, and other Python-related software, including selenium, still uses the python2 syntax structure, it may fail to run in the python3 environment.
Note that if you are an CERNET user, you may not go to the details page of the python official website. That is to say, if you want to browse org smoothly, the effect is far inferior to that of browsing com smoothly. In this case, you can right-click the Windows Installer on python2.7 on the left of the home page and use thunder to download it. Many domestic resource sites are too unprofessional. With python3, delete python2 directly. You can refer to the python section for more information. Seleniumide, which was previously installed, is a Firefox plug-in that is mainly used to record or play back recorded items. That is to say, advanced skills cannot be achieved, that is, operations through scripts. Therefore, we need to install a selenium RC. After downloading the package on the official website, it is found to be in the form of a compressed package. How to install it ?? How to install ~~~
Decompress the package and find it included. Two types of files: Selenium-server, which is used to run the selenium server. The rest is selenium-XXXX-client-driver, which is a client file used to help write scripts. The principle is that some underlying services that can control page elements can be set up through selenium server running. These services can be called through functions defined by the client, we use the script to call the client's script function to call the underlying service to control the system.
Because selenium is said to be written in Java, that is to say, the Java environment is required for running the server. Therefore, you need to download and install a Java environment. (The role of the Java environment is basically the same as that of the selenium server. It is also used to call the system. That is to say, what we actually implement is one of our hand-written scripts-call-> selenium-client.py-> selenium. jar-> java vm-> system process ).
Then copy the selenium. py file under selenium-Python-client-driver to your python2.7 installation directory, if it is D: Python27Libsite-packages directory, even if the environment installation is complete.
After the installation is complete, you can write the script as follows:

  1. Press Ctrl + R to bring up the windows running command, enter Java-jar _ Your selenium-server.jar address __, run the selenium Service
  2. Start the python-idle in the menu, open it, CTRL + N, create a file, and save it as a test. py file.
  3. Paste the code from the previous article, modify it as needed, and press F5.

Since then, the most basic use of sulenium + Python has been completed. You can play it on your own. In fact, it's also fun .....

Selenium_rc environment Configuration

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.