ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) # Click 在元素的中心点进行点击 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ## 示例用法 ```java // Java MobileElement el = driver.findElementByAccessibilityId("SomeId"); el.click(); ``` ```python # Python el = self.driver.find_element_by_accessibility_id('SomeId') el.click(); ``` ```javascript // Javascript // webdriver.io example $('#SomeId').click(); // wd example let element = await driver.elementByAccessibilityId('id', 'SomeId'); await element.click(); ``` ```ruby # Ruby # ruby_lib example find_element(:accessibility_id, 'SomeId').click # ruby_lib_core example @driver.find_element(:accessibility_id, 'SomeId').click ``` ```php # PHP $driver->byAccessibilityId('SomeId')->click(); ``` ```csharp // C# MobileElement el = driver.FindElement(MobileByAccessibilityID("Some ID"); el.click(); //Example MobileElement el = driver.FindElement(MobileById("Some ID"); el.click(); ``` [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ## 内容描述 在元素的中心位置点击元素。如果这个元素的中心位置被其他元素遮挡,就会返回元素点击的拦截错误。如果这个元素在视图外面,则返回元素不可交互的错误,不是所有的驱动程序都会自动滚动元素到视图中,为了与它交互,可能需要滚动元素到视图中来。 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ## 支持的语言及平台 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### Appium Server |平台|驱动程序|平台版本|Appium版本|驱动版本| |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../../drivers/ios-xcuitest.md) | 9.3+ | 1.6.0+ | All | | | [UIAutomation](../../drivers/ios-uiautomation.md) | 8.0 to 9.3 | All | All | | Android | [Espresso](../../drivers/android-espresso.md) | ?+ | 1.9.0+ | All | | | [UiAutomator2](../../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | All | | | [UiAutomator](../../drivers/android-uiautomator.md) | 4.3+ | All | All | | Mac | [Mac](../../drivers/mac.md) | ?+ | 1.6.4+ | All | | Windows | [Windows](../../drivers/windows.md) | 10+ | 1.6.0+ | All | [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### Appium Clients |语言|支持|文档| |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| All | [seleniumhq.github.io](https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#click--) | |[Python](https://github.com/appium/python-client/releases/latest)| All | [selenium-python.readthedocs.io](http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webelement.WebElement.click) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| All | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| All | [github.com](https://github.com/admc/wd/blob/master/lib/commands.js#L1672) | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| All | [www.rubydoc.info](https://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Element#click-instance_method) | |[PHP](https://github.com/appium/php-client/releases/latest)| All | [github.com](https://github.com/appium/php-client/) | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| All | [github.com](https://github.com/appium/appium-dotnet-driver/) | [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ## HTTP API 规范 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### 终端 `POST /session/:session_id/element/:element_id/click` [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### URL 参数 |名称|描述信息| |----|-----------| |session_id|UUID of the session| |element_id|UUID of the element| [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### JSON 参数 None [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ### 响应信息 null [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/actions/click.yml) ## 另请参阅 * [W3C Specification](https://www.w3.org/TR/webdriver/#element-click) * [JSONWP Specification](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidclick)