Commits

Bob Swift committed bc4448f

GINT-46: Add cssSelector as a By method

Comments (0)

Files changed (1)

src/main/groovy/org/swift/tools/SeleniumHelper.groovy

         if (parameters?.text != null) {
             return By.xpath("//*[text()[contains(., ${helper.quoteString(helper.getValueHandleClosure(parameters.text))})]]")
         }
+        if (parameters?.cssSelector != null) {  // see http://saucelabs.com/resources/selenium/css-selectors
+            return By.cssSelector(helper.getValueHandleClosure(parameters.cssSelector))
+        }
         if (parameters?.xpath != null) {
             return By.xpath(helper.getValueHandleClosure(parameters.xpath))
         }
         if (parameters?.text != null) {
             return [name: 'text(xpath)', value: helper.getValueHandleClosure(parameters.text)]
         }
+        if (parameters?.cssSelector != null) {
+            return [name: 'cssSelector', value: helper.getValueHandleClosure(parameters.cssSelector)]
+        }
         if (parameters?.xpath != null) {
             return [name: 'xpath', value: helper.getValueHandleClosure(parameters.xpath)]
         }