ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) # 判断元素是否相等 判断两个元素的ID是否指向同一元素 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ## 用法示例 ```java // Java // Overrides the Java Object .equals method MobileElement elementOne = (MobileElement) driver.findElementByClassName("SomeClassName"); MobileElement elementTwo = (MobileElement) driver.findElementByClassName("SomeOtherClassName"); boolean isEqual = elementOne.equals(elementTwo); ``` ```python # Python # TODO Python sample ``` ```javascript // Javascript // webdriver.io example let elementOne = $("someClass"); let elementTwo = $("someOtherClass"); let isEqual = elementOne.isEqual(elementTwo); // wd example let elementOne = await driver.elementByClassName("someClass"); let elementTwo = await driver.elementByClassName("someOtherClass"); let isEqual = await elementOne.equalsElement(elementTwo); ``` ```ruby # Ruby # ruby_lib example element1 = find_element :class_name, "someClass" element2 = find_element :class_name, "someOtherClass" element1 == element2 # ruby_lib_core example element1 = @driver.find_element :class_name, "someClass" element2 = @driver.find_element :class_name, "someOtherClass" element1 == element2 ``` ```php # PHP // TODO PHP sample ``` ```csharp // C# var elementOne = driver.FindElementByClassName("SomeClassName"); var elementTwo = driver.FindElementByClassName("SomeOtherClassName"); bool isEqual = elementOne.Equals(elementTwo); ``` [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ## 版本支持 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### Appium服务端 |平台|Driver|平台版本|Appium版本|Driver版本| |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../drivers/ios-xcuitest.md) | 无 | 无 | 无 | | | [UIAutomation](../drivers/ios-uiautomation.md) | 8.0 to 9.3 | 全部 | 全部 | | Android | [Espresso](../drivers/android-espresso.md) | ?+ | 1.9.0+ | 全部 | | | [UiAutomator2](../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | 全部 | | | [UiAutomator](../drivers/android-uiautomator.md) | 4.3+ | 全部 | 全部 | | Mac | [Mac](../drivers/mac.md) | ?+ | 1.6.4+ | 全部 | | Windows | [Windows](../drivers/windows.md) | 10+ | 1.6.0+ | 全部 | [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### Appium客户端 |编程语言|支持的版本|对应的文档| |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| 全部 | [appium.github.io](https://appium.github.io/java-client/io/appium/java_client/MobileElement.html) | |[Python](https://github.com/appium/python-client/releases/latest)| 全部 | [selenium-python.readthedocs.io](http://selenium-python.readthedocs.io/api.html) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| 全部 | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| 全部 | [github.com](https://github.com/admc/wd/blob/master/lib/commands.js#L1463) | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| 全部 | [www.rubydoc.info](https://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Element#==-instance_method) | |[PHP](https://github.com/appium/php-client/releases/latest)| 全部 | [github.com](https://github.com/appium/php-client/) | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| 全部 | [github.com](https://github.com/SeleniumHQ/selenium/blob/master/dotnet/src/webdriver/Remote/RemoteWebElement.cs) | [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ## HTTP应用程序接口文档 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### 接口 `GET /session/:session_id/element/:element_id/equals/:other_element_id` [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### URL参数 |参数名|参数描述| |----|-----------| |session_id|执行命令所使用到的session ID| |element_id|元素ID| |element_id|另一个被比较的元素ID| [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### JSON参数 无 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ### 返回结果 是否两个元素的ID指向的是同一元素(`boolean`) [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/equals-element.yml) ## 其他链接 * [JSONWP 文档](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidequalsother)