Skip to content

Commit

Permalink
Removed fireEventIfElementExists and dependencies on it. fireEvent wa…
Browse files Browse the repository at this point in the history
…s not always working.
  • Loading branch information
marisaseal committed Feb 23, 2010
1 parent dfed06f commit 233138c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion FitNesseRoot/RecentChanges/content.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|SlimSeleniumDriver||16:01:05 Mon, Feb 15, 2010|
|SlimSeleniumDriver||14:31:35 Thu, Feb 18, 2010|
|SlimSeleniumDriver.SuiteAcceptanceJava||15:58:27 Mon, Feb 15, 2010|
|SlimSeleniumDriver.SuiteAcceptanceJava.SetUp||15:54:44 Mon, Feb 15, 2010|
|SlimSeleniumDriver.SuiteAcceptanceJava.CheckTest||15:31:52 Mon, Feb 15, 2010|
Expand Down
1 change: 1 addition & 0 deletions FitNesseRoot/SlimSeleniumDriver/content.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*All Selenium RC 1.0.1 methods are available via !-SeleNesse-!
*Methods that provide interaction with a page element (such as ''click'', ''type'', etc.) first determine whether the page element exists. If the element exists, the appropriate action is triggered, and the method returns ''true''. If the element does not exist, the corresponding action is '''not''' triggered, and the method returns ''false''.
*Note the use of the Slim script table sequential argument processing suffix ";" - !-FitNesse 20100103 or later is required to use this style of method call in Slim script tables.-!
*'''!-|check|getFoo|expected foo value|-!''' is the recommended way to implement Selenium IDE's "verifyFoo" methods - using the script table's ''check'' keyword ensures that the actual and expected values are displayed in the test results.

>SuiteAcceptanceJava

Expand Down
Binary file modified bin/selenesse/SlimSeleniumDriver$WaitForElementToAppear.class
Binary file not shown.
Binary file modified bin/selenesse/SlimSeleniumDriver$WaitForTextToAppear.class
Binary file not shown.
Binary file modified bin/selenesse/SlimSeleniumDriver.class
Binary file not shown.
Binary file modified dist/java/selenesse.jar
Binary file not shown.
44 changes: 24 additions & 20 deletions src/selenesse/SlimSeleniumDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public void pause(int milliseconds) throws InterruptedException {

//Element interaction methods
public boolean click(String locator) {
return fireEventIfElementExists("click", locator);
boolean elementFound = seleniumInstance.isElementPresent(locator);
if (elementFound) {
seleniumInstance.click(locator);
return true;
}
return false;
}

public boolean clickAt(String locator, String coordinates) {
Expand Down Expand Up @@ -73,15 +78,30 @@ public boolean clickUpToTimes(String locator, int numberOfTimesToExecute) {
}

public boolean focus(String locator) {
return fireEventIfElementExists("focus", locator);
boolean elementFound = seleniumInstance.isElementPresent(locator);
if (elementFound) {
seleniumInstance.focus(locator);
return true;
}
return false;
}

public boolean makeChecked(String locator) {
return fireEventIfElementExists("check", locator);
boolean elementFound = seleniumInstance.isElementPresent(locator);
if (elementFound) {
seleniumInstance.check(locator);
return true;
}
return false;
}

public boolean makeNotChecked(String locator) {
return fireEventIfElementExists("uncheck", locator);
boolean elementFound = seleniumInstance.isElementPresent(locator);
if (elementFound) {
seleniumInstance.uncheck(locator);
return true;
}
return false;
}

public boolean select(String selectLocator, String optionLocator) {
Expand Down Expand Up @@ -169,22 +189,6 @@ public boolean until(){
}
}

private boolean fireEventIfElementExists(String actionName, String locator) {
boolean elementFound = seleniumInstance.isElementPresent(locator);
if (elementFound) {
try {
seleniumInstance.fireEvent(locator, actionName);
}
catch (SeleniumException e) {
if (isKnownSeleniumBug(e)) {
fireEventIfElementExists(actionName, locator);
}
throw e;
}
}
return elementFound;
}

private boolean optionIsAlreadySelected(String selectLocator, String optionLocator) {
if ((optionLocator.startsWith("id=")
&& seleniumInstance.getSelectedId(selectLocator).equals(optionLocator.replace("id=", ""))) ||
Expand Down

0 comments on commit 233138c

Please sign in to comment.