简体   繁体   English

当按钮没有名称或 ID 时,我应该使用什么作为 `click()` 方法的参数?

[英]What do I use as the argument for the `click()` method when the button has no name or ID?

I'm using the Java Selenium RC and I want to know how to use the click method from the DefaultSelenium.我正在使用 Java Selenium RC,我想知道如何使用 DefaultSelenium 中的单击方法。 How do I specify to click a button?如何指定单击按钮? I know when I use the "Inspect Element" on a button sometimes it says name=btng or id="search" but sometimes it has neither.我知道当我在按钮上使用“检查元素”时,有时会显示name=btngid="search"但有时两者都没有。 When this is the case, what do I use as the argument for the click() method?在这种情况下,我应该使用什么作为click()方法的参数?

Selenium supports a number of strategies for locating an element on a page, including id, name, css, xpath, etc. Details on the supported Element Locators can be found here . Selenium 支持在页面上定位元素的多种策略,包括 id、name、css、xpath 等。支持的元素定位器的详细信息可以在这里找到。

暂无
暂无

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

相关问题 当 ID 不是 static 时,我应该为 Click Button 使用哪个定位器? - Which locator should I use for Click Button when Id is not static? 如何调用以方法为参数的方法? - How do I call a method that has a method as its argument? 单击按钮时停止执行方法 - Stop executing a method when i click a button 没有ID和名称的HTML按钮如何找到? - How to find a Html button when it has no ID and Name? 将参数与PowerMockito模拟静态方法一起使用时,为什么参数类型不匹配? - Why do I get an argument type mismatch when I use arguments with PowerMockito mocked static method? 单击JCheckBox时执行什么方法 - what method is executed when I click a JCheckBox 如何使用以Object作为参数的方法正确实现接口? - How do I correctly implement an interface with a method that has Object as an argument? 当我执行driver.findElementById(“some id”)时,内部会发生什么。click()? 它执行一个JavaScript吗? - What happens internally when i do driver.findElementById(“some id”).click()? does it execute a javascript? 我可以在java中为公共变量和方法参数使用相同的名称吗? - Can I use same name for public variable and method argument in java? 当用户单击“ x”按钮时,我可以在Java Swing中做什么以最小化窗口(而不是关闭窗口)? - What can I do in Java Swing to minimize the window (and not to close it) when the user click on the “x” button?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM