Selenium-web interface Testing Tool
1. Selenium can use the recording tool to record the script and test the page.
2. Selenium can generate HTML-like code, Java code, and Ruby code.
3. Selenium recording tool locates HTML elements based on the ID attribute
1. Install Firefox, selenium ide plug-in, and firebug plug-in.
2. Unzip selenium's selenium-remote-control package to get the selenium-server.jar.
3. Get selenium-java-client-driver.jar for selenium development in Java language.
Use of selenium ide
1. Firefox -- tool -- selinum ide
2. Click the recording button to start recording a test. You can use a browser to perform operations.
3. Click the stop recording button of selenium ide To view scripting languages such as HTML, Java, and Ruby.
In addition to recording HTML requests and Ajax call operations, seleniumide. Other operations that do not involve communication will also be recorded. Other automatic script recording tools, such as webload and LoadRunner, only record HTTP requests and cannot actually record page operations.
4. The script can be formatted into multiple languages.
5. selinum uses XPath and CSS to select HTML elements.
How selenium works
Selenium is different from general testing tools. The recording script of a general script testing tool is actually implemented by intercepting HTTP requests sent and received by the browser. In fact, there is no way to record users' operations on HTML pages.
Of course, this type of simulation is sufficient for the tools that perform stress testing.
Selenium's script recording tool records scripts by listening to users' operations on HTML pages. Selenium is a recording tool that truly monitors users' operations on HTML pages. Selenium fully understands the HTML page for user operations.
Selenium can generate scripts in seven languages: HTML, Java, C #, Ruby, Python, Perl, and PHP.
You can directly execute HTML scripts in seleniumide. Firefox on your machine will execute the selenium script.
HTML scripts generated by selenium are a set of scripting languages developed by Selenium Using HTML language elements.
If you want to execute the selenium script in other language formats, you need to use the selenium server. The use of the six languages is the same.
Internal execution principle of Selenium
Seleniumserver communicates with the selenium client over the network to receive selenium test commands.
The selenium client is generally implemented using unit test technology. It determines whether the program runs correctly by judging whether the returned results are consistent with the expected ones.
Browsers supported by selenium RC
Selenium Remote Control: server command line parameters
Example: Java-jar selenium-server.jar [-interactive] [Options]
-Port <NNNN>: the port number used by the selenium server (4444 by default)
-Timeout <NNNN>: the number of seconds that we waited for before giving up (timeout ).
-Interactive: Enter the interaction mode. Refer to the tutorial for more information
-Multiwindow: the mode in which all tested websites are opened in a separate window. Selenium supports frame.
-Forcedbrowsermode <Browser>: sets the browser mode (for example, all sessions use "* iexplore", regardless of the parameter passed to getnewbrowsersession)
-Browsersessionreuse: Stop reinitializing and replacing the browser during the test.
-Alwaysproxy: by default, we can perform as few proxies as possible. setting this flag will force all browser communications to pass through the proxy.
-Firefoxprofiletemplate <dir>: Generally, a clean Firefox setting is generated before each startup. You can specify a directory for us to copy your settings instead of what we generated.
-Debug: enters the debug mode and more tracing debugging information is available.
-Htmlsuite <Browser> <starturl> <suitefile> <resultfile>: Use the specified browser (for example, "* Firefox") at the specified URL (for example, "http://www.google.com "), run a separate HTML selenese (selenium core) test suite and exit immediately. You must specify the absolute path of the HTML test suite and the path of the HTML test result file that we will generate.
-Proxyinjectionmode: Enter the proxy injection mode. In this mode, the selenium server acts as the proxy server that enters all the content of the test program. In this mode, access is allowed across multiple domains, and the following additional parameters are also supported:
-Dontinjectregex <RegEx>: the added regular expression. The proxy injection mode can be used to determine whether to inject the regular expression.
-Usercontenttransformation <RegEx> <replacement>: a regular expression that matches all tested HTML content. The second string replaces all matched content. This flag can be used multiple times. A simple example of using this parameter: If you add "-usercontenttransformation https http", all "HTTPS" strings in the HTML of the test application will be replaced with "HTTP ".