selenium源码通读·12 |webdriver/remote分析

Posted NoamaNelson

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了selenium源码通读·12 |webdriver/remote分析相关的知识,希望对你有一定的参考价值。

·12 |webdriver/remote分析

1 源码路径

selenium/webdriver/remote

2 功能说明

方法描述说明
command.pyDefines constants for the standard WebDriver commands定义标准WebDriver命令的常量
errorhandler.pyError codes defined in the WebDriver wire protocolWebDriver wire协议中定义的错误代码
file_detector.pyUsed for identifying whether a sequence of chars represents the path to a file用于标识字符序列是否表示文件的路径
getAttribute.js/获取属性
isDisplayed.js/判断元素是否显示
mobile.py/定义移动端的功能
remote_connection.pyA connection with the Remote WebDriver server与远程WebDriver服务器的连接
switch_to.py/切换能力
utils.py/辅助能力
webdriver.pyThe WebDriver implementation定义webdriver核心API
WebElement.pyRepresents a DOM element定义对webdriver element操作的能力

3 部分功能详解

3.1 command.py

  • 定义标准WebDriver命令的常量;

  • 如下:

  • 比如我们常用的(部分):

常量
CLOSEclose
QUITquit
GETget
REFRESHrefresh
GET_COOKIEgetCookie
FIND_ELEMENTfindElement
FIND_ELEMENTSfindElements
GET_TITLEgetTitle
SCREENSHOTscreenshot
SET_TIMEOUTSsetTimeouts
MAXIMIZE_WINDOWwindowMaximize
MINIMIZE_WINDOWminimizeWindow
  • Alerts相关常量

  • Advanced user interactions常量

  • Screen Orientation常量

  • Touch Actions常量

  • html 5常量

  • Mobile常量

3.2 errorhandler.py

  • WebDriver wire协议中定义的错误代码
  • 如下:
  • 代码说明:
代码标识说明
0SUCCESS成功
7NO_SUCH_ELEMENTno such element
8NO_SUCH_FRAMEno such frame
9UNKNOWN_COMMANDunknown command
10STALE_ELEMENT_REFERENCEstale element reference
11ELEMENT_NOT_VISIBLEelement not visible
12INVALID_ELEMENT_STATEinvalid element state
13UNKNOWN_ERRORunknown error
15ELEMENT_IS_NOT_SELECTABLEelement not selectable
17javascript_ERRORjavascript error
19XPATH_LOOKUP_ERRORinvalid selector
21TIMEOUTtimeout
23NO_SUCH_WINDOWno such window
24INVALID_COOKIE_DOMAINinvalid cookie domain
25UNABLE_TO_SET_COOKIEunable to set cookie
26UNEXPECTED_ALERT_OPENunexpected alert open
27NO_ALERT_OPENno such alert
28SCRIPT_TIMEOUTscript timeout
29INVALID_ELEMENT_COORDINATESinvalid element coordinates
30IME_NOT_AVAILABLEime not available
31IME_ENGINE_ACTIVATION_FAILEDime engine activation failed
32INVALID_SELECTORinvalid selector
33SESSION_NOT_CREATEDsession not created
34MOVE_TARGET_OUT_OF_BOUNDSmove target out of bounds
51INVALID_XPATH_SELECTORinvalid selector
52INVALID_XPATH_SELECTOR_RETURN_TYPERinvalid selector
60ELEMENT_NOT_INTERACTABLEelement not interactable
/INSECURE_CERTIFICATEinsecure certificate
61INVALID_ARGUMENTinvalid argument
/INVALID_COORDINATESinvalid coordinates
/INVALID_SESSION_IDinvalid session id
62NO_SUCH_COOKIEno such cookie
63UNABLE_TO_CAPTURE_SCREENunable to capture screen
64ELEMENT_CLICK_INTERCEPTEDelement click intercepted
/UNKNOWN_METHODunknown method exception
405METHOD_NOT_ALLOWEDunsupported operation

『全栈测试技术,分享,共勉,共进,提升』


以上是关于selenium源码通读·12 |webdriver/remote分析的主要内容,如果未能解决你的问题,请参考以下文章

selenium源码通读·13 |webdriver/support分析

selenium源码通读·4 |webdriver/common分析

selenium源码通读·3 | 从源码看引入webdriver包的原因

selenium源码通读·7 |webdriver/common/by.py-By类分析

selenium源码通读·10 |webdriver/common/proxy.py-Proxy类分析

selenium源码通读·11 |webdriver/common/touch_actions.py-TouchActions类分析