简体   繁体   中英

Selenium RC ( Dynamic Id Generation)

我在Eclipse和JUnit中使用Selenium RC,如何捕获动态ID,请尽快回答

To use work against dynamic IDs you need to either use CSS selectors or XPath.

For xpath you would have xpath=//input[@contains(@id,'partOfId')] to find an input where you know part of the ID or for css it would be css=input[id^='partOfId']

To make them static isn't always possible for particular project(framework used).

You may deal with developers, that they provide rules for ID prefixes or postfixes.

And then check correspondingly with XPATH selectors and regexp.

You can use static name instead. Or your own custom locator

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM