Various driver of selenium webdriver

Source: Internet
Author: User
Tags selenium grid

Selenium official plus a third-party announced support for a variety of drivers, in addition to the PC-side browser, but also support the iphone, Android driver, about the selenium supported by the various driver purposes and instructions.

Selenium supported PC browser drivers include:

FF driver "included in the client of the respective language"

Safari driver "included in Selenium server"

IE driver

Chrome driver "third party"

Opera driver "third party"

Selenium supported pseudo-browser drivers:

Phantomjs Driver "Third party"

Htmlunit Driver "included in Selenium server"

Selenium supported mobile-side drivers:

Windows Phone Driver "third party"

Selendroid-selenium for Android "third party"

Ios-driver "Third party"

Appium supports iphone, ipad, Android, Firefoxos "third party"

All of the above drivers can be called directly from the respective language client or registered to a selenium grid for distributed remote calls.

Because the mobile side of the driver have not tried, so do not explain. PC-side driver are browser-based and are divided into 2 main types:

One is the real browser driver

For example: Safari, FF Drive the browser itself in the form of plug-ins, ie, chrome is the binary files to drive the browser itself;

These driver are launched directly and driven by invoking the browser's underlying interface to drive the browser, thus having the most realistic user scenario simulations, primarily for web compatibility testing use.

One is pseudo browser driver

Selenium supported pseudo-browsers include Htmlunit, PHANTOMJS; they are not really in the browser, there is no GUI, but with the support of HTML, JS and other parsing capabilities of the class browser program, these programs do not render the display of the page, but support page element lookup , JS implementation, and so on, because no CSS and GUI rendering, so the efficiency of the operation than the real browser is much faster, mainly used in functional testing above.

Htmlunit is a Java-implemented class browser program, included in the selenium server, without the need for driver, direct instantiation can be, its JS parsing engine is Rhino

Phantomjs is a third party's independent class browser application, can support HTML, JS, CSS and other execution; its driver is ghost driver after 1.9.3 has been packaged into the main program, so just download a main program, its JS parsing engine is chrome The V8.

Driver Type Advantages Disadvantages Application
Real Browser driver Real-world simulation of user behavior Low efficiency and stability Compatibility test
Htmlunit Fast speed JS engine is not supported by the mainstream browser Page test with a small number of JS
Phantomjs Medium speed, simulated behavior close to reality Cannot simulate behavior of different/specific browsers Functional testing of non-GUI

PS: In addition to the above several real browser driver, but also by different means to cancel the browser's CSS parsing, interface rendering, etc., so as to ensure the true compatibility of the browser, but also improve the efficiency of the implementation of the problem, the use of means: AutoIt, Pyvirtualdisplay, browser settings, and more.

Comparison of the efficiency of several PC end driver:

 fromSeleniumImportWebdriverImportTime Drivers= ['Htmlunit','Phantomjs','Chrome','FF','IE'] Dervers_time= {      'Htmlunit': 0,'Phantomjs': 0,'Chrome': 0,'FF': 0,'IE': 0,} times= 50defrun_with_chrome (): Common_step (Webdriver. Chrome ())defrun_with_ff (): Common_step (Webdriver. Firefox ())defRun_with_ie (): Common_step (Webdriver. Ie ())defRun_with_phantomjs (): Common_step (Webdriver. PHANTOMJS (Executable_path=r'C:\Python27\Scripts\phantomjs.exe'))        defrun_with_htmlunit (): Driver= Webdriver. Remote ("Http://localhost:4444/wd/hub", Desired_capabilities=Webdriver. Desiredcapabilities.htmlunit) Common_step (driver)defCommon_step (Driver): Driver.get ('http://www.baidu.com') Ele= driver.find_element_by_id ('su')      PrintEle.get_attribute ('value') Driver.quit () forIinchRange (times):Print '=============times%s============'%I forDriverinchDrivers:start=time.time ()PrintStart eval ('run_with_%s ()'%driver) End=time.time ()PrintEnd Elapse_time= end-start Dervers_time[driver]+=Elapse_timePrint 'Elapse for%s:%s'%(Driver, elapse_time) forKvinchDervers_time.items ():Print 'avg Elapse for%s in%s times:%s'% (k, Times, V/times)

Results obtained:

 

The quickest is htmlunit, PHANTOMJS, Chrome, ie, FF

Various driver of selenium webdriver

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.