---
name: Are Elements Equal
short_description: Test if two element IDs refer to the same element

# TODO: I'm not sure if all the clients support this method or not.
example_usage:
  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:
    |
      # TODO Python sample
  javascript_wd:
    |
      let elementOne = await driver.elementByClassName("someClass");
      let elementTwo = await driver.elementByClassName("someOtherClass");
      let isEqual = await elementOne.equalsElement(elementTwo);
  javascript_wdio:
    |
      # TODO WDIO example
  ruby:
    |
      element1 = @driver.find_element :class_name, "someClass"
      element2 = @driver.find_element :class_name, "someOtherClass"
      element1 == element2
  php:
    |
      // TODO PHP sample
  csharp:
    |
      // TODO C# sample

client_docs:
  java: "https://appium.github.io/java-client/io/appium/java_client/MobileElement.html"
  python: "http://selenium-python.readthedocs.io/api.html" # TODO Python documentation link
  javascript_wdio: "http://webdriver.io/api/state/isEnabled.html"
  javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L1463"
  ruby: "http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Element#==-instance_method"
  php: "https://github.com/appium/php-client/" # TODO PHP documentation link
  csharp: "https://github.com/appium/appium-dotnet-driver/" # TODO Dotnet documentation link

# TODO: Confirm support for these per platform
driver_support:
  ios:
    xcuitest: false
    uiautomation: true
  android:
    uiautomator2: true
    uiautomator: true
  mac:
    mac: true
  windows:
    windows: true
client_support:
  java: true
  python: true
  ruby: true
  php: true
  csharp: true
  javascript_wd: true
  javascript_wdio: true


# Information about the HTTP endpoints
endpoint:
  url: /wd/hub/session/:session_id/element/:element_id/equals/:other_element_id
  method: 'GET'
  url_parameters:
    - name: session_id
      description: ID of the session to route the command to
    - name: element_id
      description: ID of the element
    - name: element_id
      description: ID of the other element to check if they're equal
  response:
    - type: boolean
      description: Whether the two ID's refer to the same element

# Links to specifications. Should link to at least one specification
specifications:
  jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidequalsother
