简体   繁体   English

除了click()和submit()方法之外还有其他方法可以选择/单击selenium Webdriver中的web元素吗?

[英]Apart from click() and submit() method is there any other way to select/click a web element in selenium Webdriver?

In Java 在Java中

WebElement button = driver.findElement(By.id(""));
//For clicking the button...  
button.click();

Is there any other way to click webElement like radio boxes ,Checkboxes ,buttons etc..? 有没有其他方法可以点击webElement,如收音机盒,复选框,按钮等..?

If you want to click something, why would you use something else? 如果你想点击什么,你为什么要用别的东西? I guess click() is the best method for elements to be clickable. 我猜click()是元素可点击的最佳方法。

Still you can use enter to perform the same. 仍然可以使用enter来执行相同的操作。

WebElement button = driver.findElement(By.id(""));
button.sendKeys(Keys.Enter);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium Webdriver submit()vs click() - Selenium Webdriver submit() vs click() 如何从列表中选择元素,单击它,返回列表,然后使用Selenium Webdriver选择下一个元素 - How to select element from the list, click on it, go back to the list and select next element using selenium webdriver 无法单击 Selenium webdriver 中的元素 - Not able to click on a element in Selenium webdriver 扩展Webdriver或Selenium2的click()方法以计算网页响应 - Extend click() method of Webdriver or Selenium2 to calculate web page response 如何从下拉列表循环中选择所有列表选项,选择每个选项,然后使用Selenium Webdriver单击Submit按钮 - How to select all list options from drop downlist loop through them selcet each option and click submit button using selenium webdriver 从Selenium Webdriver - Java中的右键菜单中选择一个选项 - Select an Option from the Right-Click Menu in Selenium Webdriver - Java 如何在方法中创建方法以创建并单击Selenium中的Web元素 - How to create a method within a method to create and click on a web element in Selenium 如何在硒中单击此外部 div 元素(或其中的任何其他跨度) - how to click this outer div element(or any other span inside it) in selenium Selenium Webdriver返回表元素并实现单击 - Selenium Webdriver return table element and implement click 使用 Selenium Webdriver 单击 JQUERY 元素时出现问题 - Problems to click in a JQUERY element using Selenium Webdriver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM