Author: ppitonak(a)redhat.com
Date: 2009-10-27 09:40:15 -0400 (Tue, 27 Oct 2009)
New Revision: 15764
Modified:
branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/AbstractSeleniumTestCase.java
Log:
* method belongsClass fixed to work also with jQuery locators
* added method getJQueryCount (similar to getXpathCount)
Modified:
branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/AbstractSeleniumTestCase.java
===================================================================
---
branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/AbstractSeleniumTestCase.java 2009-10-27
09:11:02 UTC (rev 15763)
+++
branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/AbstractSeleniumTestCase.java 2009-10-27
13:40:15 UTC (rev 15764)
@@ -718,6 +718,23 @@
}
/**
+ * Returns the count of elements for given jQuery locator.
+ * @param locator a jQuery locator that doesn't end with :eq(), :last, :first,
:odd, etc.
+ * @return count of elements matching given locator
+ */
+ public int getJQueryCount(String locator) {
+ int count = 0;
+ for (int i = 0;; i++) {
+ if (selenium.isElementPresent(format(locator + ":eq({0})", i))) {
+ count++;
+ } else {
+ break;
+ }
+ }
+ return count;
+ }
+
+ /**
* Checks if element given by locator is member of CSS class given by
* className.
*
@@ -732,7 +749,7 @@
Validate.notNull(className);
Validate.notNull(locator);
- String classLocator = format("{0}/@class", locator);
+ String classLocator = format("{0}@class", locator);
String classNames = getAttributeOrNull(classLocator);
if (classNames == null) {
Show replies by date