Selenium RC Environment Configuration
2011-10-19 12:58 by Zerg, 37117 read, 12 reviews, Favorites, compilation
Search on the internet for a long time, did not find a specific configuration, just simple to write a few steps, their own pondering a bit, so, would like to organize an article, easy to review later.
This article is to refer to the official website of the steps carried out, of course, also do not complete the same. Here I would like to say is the Java environment, if you are used in other languages, please refer to other articles.
Below, we build our environment through eclipse.
Http://seleniumhq.org/docs/appendix_installing_java_driver_client.html#configuring-selenium-rc-with-eclipse
====================== Environment Preparation ========================================
Eclipse SDK: This is easy to find and will not be attached.
Junit 4:https://github.com/kentbeck/junit/downloads I'm using the latest version of it, you're free.
Selenium rc:http://seleniumhq.org/download/This is the official website link, I looked for a half day did not hit to find the next. Despise yourself here. I downloaded it from CSDN: http://download.csdn.net/detail/fanxinyuan/2695339
Firefox:firefox 6.0.2 Although the official said any version can be, but my firefox7.0.1 installed Selenium IDE has been unsuccessful, OK. Despise yourself again.
Selenium Ide:selenium IDE 1.3.0
Selenium IDE:
First of all, he as a plugin for Firefox browser exists, attached to the Firefox browser, open its recording function, it will faithfully record the operation of your Firefox, and can play back it recorded your operation. An automatic recording function similar to QTP. You know! I don't have much to say here.
Method One:
Let's start by installing the selenium IDE ...
Open the Firefox browser and go to the official website: http://seleniumhq.org/download/
Find the Selenium IDE download link, Firefox will be prompted to install the plugin, click Install.
Method Two:
Of course, you can do it in a different way.
In the Firefox menu bar, select Tools--->add-ons Manager (add components) and then search selenium IDE Click Download to install the reboot.
Selenium IDE Use :
Open Plugin
All right! Tell you what to do. (Open a new tab in the browser----Enter the Baidu URL-----in the Search bar input "" Selenium "click the Search button) is such a simple process.
When the recording is complete, click the Red button to end the recording.
You can click the Green Triangle button to play back the recorded script. Like mine, playback is no problem.
About the Selenium IDE is not much to say, specific to the recording script changes, additions and so on, please refer to other information. If I learn more things will be brought to share with you. Hee Hee
======================================================================
Selenium RC:
Selenium RC of course no Selenium IDE so fool, surface see it is more professional, more powerful, not limited to the Firefox browser plug-in so simple, but also support a variety of languages oh. (PS:QTP is only supported for VBS scripts!) )。 Selenium RC supports Java, scharp, Python, Ruby, PHP, Perl and other language environments, it seems very strong say.
Here are the highlights to build our Java environment.
Open the Eclipse SDK tool.
First step: Create a project, New---project ...
Step Two: import the packages we need
Right-click on the project we created-----build Path-----Add External Archives ...
After the completion of the following:
Junit-4.10.jar : In the Junit 4 compression package we downloaded.
Selenium-java-client-driver.jar: Under the selenium-remote-control-1.0.3 folder we downloaded.
. (..... \selenium-remote-control-1.0.3\selenium-java-client-driver-1.0.1\)
Selenium-server.jar : Under the selenium-remote-control-1.0.3 folder we downloaded.
..... \selenium-remote-control-1.0.3\selenium-server-1.0.3\
Here we export the recorded script and put it into the out.
Put the code in the JUnit 4 type code, and I'll save it here as Test.java and copy it into my project.
In the Com.test package under the SRC folder:
The code reads as follows:
Package com.test;
Import com.thoughtworks.selenium.*; Import Org.junit.After; Import Org.junit.Before; Import Org.junit.Test; Import Java.util.regex.Pattern;
public class Test extends Selenesetestcase { @Before public void SetUp () throws Exception { selenium = new Def Aultselenium ("localhost", 4444, "*chrome", "http://www.baidu.com/"); If this does not work, modify the browser to *firefox or *iexplore selenium.start (); }
@Test public void Testtest () throws Exception { Selenium.open ("/"); Selenium.open ("/index.html"); You can increase the page type //selenium.windowsmaximize (); Future browser window magnification selenium.type ("id=kw", "Selenium"); Selenium.click ("Id=su"); Selenium.waitforpagetoload ("30000"); }
@After public void TearDown () throws Exception { selenium.stop ();} }
Below to start the service.
Start---Run---cmd to open a command prompt.
Navigate to the ...selenium-remote-control-1.0.3\selenium-server-1.0.3> directory.
Input: Java-jar Selenium-server.jar Enter. The service was started.
This way is more troublesome, we can write a batch to finish the work above.
Open a Notepad and enter the Java-jar selenium-server.jar command. Saved as a. bat file. The next time you double-click the file, it starts.
The "-interactive" behind the command is another way to start the selenium RC.
Below in our eclipse is the run, Test.java program.
will automatically call our browser to start running.
Hope to learn the most, please find "Selenium private Cuisine series"
Selenium RC Environment Configuration