WebDriver和浏览器之间通信所使用的机制是什么 [英] What is the mechinism used for commiunication between webdriver and browser

查看:234
本文介绍了WebDriver和浏览器之间通信所使用的机制是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释浏览器和Web驱动程序之间如何进行通信? webdriver对象如何读取和识别浏览器中的html元素?为此,webdriver对象和浏览器之间是什么关系?如何建立浏览器和webdriver对象的关系?

Anyone can explain how communication happen between browser and web-driver?. How does webdriver object read and identify html elements in browser ?. For that what is the relationship between webdriver object and browser and how to build the relationship browser and webdriver object?

 driver = new FirefoxDriver(); 
 driver.findElements(By.id("element")); 

推荐答案

webdriver和浏览器之间的通信是通过

The communication between webdriver and browser happens through a json-wire protocol which is specified in the W3C documentation. All browsers that webdriver supports, uses this same protocol.

Webdriver如何读取和识别页面中的元素?随浏览器的不同而不同.

How does webdriver read and identify elements in a page? This varies from browser to browser.

Firefox -运行该驱动程序时,将网络驱动程序作为插件安装在浏览器中. WebDriver服务器将向该插件发送json命令,并且这些命令将在浏览器中执行.该插件内置在webdriver jar文件中.将在运行测试时安装它.

Firefox - webdriver gets installed as a plugin in your browser while running the test. The webdriver server will send the json-commands to this plugin and those commands will get executed in the browser. The plugin is built within the webdriver jar file. It will get installed while running the test.

Chrome -要测试chrome,您还需要chromedriver.exe文件.此chromedriver.exe的行为类似于firefox插件.它可以从webdriver服务器接收命令并在浏览器中执行

Chrome - For testing chrome, you would also need a chromedriver.exe file. This chromedriver.exe acts similar to the firefox plugin. It can receive the commands from webdriver server and execute it on the browser

IE -与Chrome类似,IE在InternetExplorerDriver.exe的帮助下执行.

IE - Similar to Chrome, IE executes with the help of InternetExplorerDriver.exe.

通过查看 github .

您还可以从此处获得有关工作的理解- http://www.aosabook. org/en/selenium.html . 我不确定此页面的更新方式,但是应该有助于理解该概念.

You can also get an understanding about the working from here - http://www.aosabook.org/en/selenium.html. I am not sure how updated this page is, but should help to understand the concept.

这篇关于WebDriver和浏览器之间通信所使用的机制是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆