In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)05/31 Report--
This article is about the similarities and differences between Selenium and Appium. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Some time ago, I learned how to use selenium. Today, I got confused when I came into contact with appium and saw the principle of appium:
Selenium now operates and drives browsers through webdriver, but appium has a concept of server
So why is there no such thing as app driver?
Selenium
Early selenium
The early selenium mainly refers to the version of selenium1.0.
This version is mainly composed of Selenium IDE + Selenium Grid + SeleniumRC
SeleniumRC is a proxy server that was later replaced by webdriver.
RC = = Remote Control remote control
Early Selenium introduced Remote Control Server as a proxy Server,JavaScript script injection and communication with Server through this proxy Server, JavasScript can get and call any element of the page, Selenium starts a Server, converts the API call that operates on the Web element into a segment of JavaScript, and injects this JS after the Selenium kernel starts the browser
Disadvantages: however, the JS injection speed is not ideal, and the stability depends greatly on the quality of the JS translated by the Selenium kernel to API.
The proxy Remote Control Server is introduced because of the limitation of the "same origin policy". Through this proxy server, the remote Server is "deceived" to make it think that the load code is from the same place to return the requested data correctly.
The principle of seleniumRC
1.Selenium RC Server launches a browser (or is already in use) and injects js code
two。 Transfer the test script code to the client's Selenium-Core
3.Selenium-Core translates and parses and performs user recording operations.
4. Let the agent Server communicate
5.Remote Control Server is responsible for communicating with remote Web application servers
The composition of seleniumRC
1.Selenium Server (Launcher, Http Proxy, Selenium Core)
2.Client Libraries (used to control server)
The workflow of seleniumRC
1. The test case sends a Http request to Selenium Server through the interface of Client Libraries to establish a connection with Selenium Server
The Launcher of 2.Selenium Server launches the browser, loads the Selenium Core into the browser page, and the proxy of the concurrent browser is set to Selenium Server's Http Proxy.
3. The test case sends a Http request to Selenium Server through the interface of Client Libraries, Selenium Server parses the request, and then sends a JS command through Http Proxy to inform Selenium Core to perform the action of operating the browser.
When 4.Selenium Core receives the instruction, it executes the operation
5. The browser receives the new page request information and sends a Http request for a new web page. Selenium Server will receive all requests from browsers launched by it
After receiving the Http request sent by the browser, 6.Selenium Server reorganizes the Http request to get the corresponding web page
The Http Proxy of 7.Selenium Server returns the received Web page to the browser
Today's selenium
Selenium3.0 later removed seleniumRC and replaced it with webdriver
Use a diagram to show how selenium3.0 works.
Here we are talking about the interaction between the test script and the browser. When the client starts to run the script that drives the browser, the browser receives a request to start and open the listening port, and automatically create a session to maintain the session connection between the browser and the corresponding client. Then the client runs the script, sends the http request to the browser, the browser parses the request, takes corresponding actions according to the content of the script, and returns response. At this point, the client chooses whether to end or continue execution according to the response.
Tips:
1.webdriver operating browser, the protocol adopted on the page: the webdriver wire protocol
Communication Protocol between 2.Client and Server: HTTP
The data transmitted by 3.HTTP is in json format according to WP protocol.
4. The browser driver implements the api of webdriver protocol.
Appium
The difference between appium and selenium
Appium itself is a server, while selenium discards server and uses webdriver to drive browsers
How appium works
When the appium server is opened, the listening port is opened. When we run the script, any appiumAPI we call will post a HTTP request to the Appium Server side. The request content is a piece of data in JSON format specified in the webdriver wire protocol protocol. After receiving the request, the Appium Server side parses the JSON data and sends it to the mobile end. The socket server that has been opened by BootStrap.jar (iOS is BootStrip.js) on the mobile terminal listens to the corresponding port. BootStrap.jar is automatically installed when each session of appium accesses the mobile terminal for the first time. After receiving the corresponding request, the mobile terminal translates it into commands that can be executed by UIAutomator through BootStrap.jar, and then processes and operates APP through UIAutomator to complete the test.
Several Concepts of appium
1.appium/appium server
The so-called appium is actually a node.js-based web server, which is a bridge between test scripts and device-side interaction.
Appium server without interface is installed on the command line with npm install-g appium
2.appium GUI
It encapsulates the appium server without interface into a graphical interface, which is easy to operate, but it has now been replaced by appium desktop.
3.appium Desktop
It is an open source application for Mac,Windows and Linux. It provides you with the powerful functions of appium server with a beautiful and flexible user interface.
4.appium client
As mentioned in point 1, appium is actually a sweb server,server that receives requests to operate the app on the device side. Since there is server, then there must be client.
This client is the package we imported when we wrote the test script.
You can run pip install Appium-Python-Client in Python to install
Android and iOS
Thank you for reading! This is the end of the article on "what are the similarities and differences between Selenium and Appium". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.