Skip to content

Instantly share code, notes, and snippets.

@patrickhammond
Created November 21, 2012 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickhammond/4122384 to your computer and use it in GitHub Desktop.
Save patrickhammond/4122384 to your computer and use it in GitHub Desktop.
Brazenhead issues while trying to invoke the action bar home button
Scenario: View the navigation menu
When I expose the navigation menu
{"exception":"java.lang.reflect.InvocationTargetException","theCause":{"exception":"java.lang.NullPointerException"}} (Exception)
./features/step_definitions/screenshot_defs.rb:12:in `/^I expose the navigation menu$/'
features/screenshots.feature:8:in `When I expose the navigation menu'
Then I can take a screenshot of the "navigation menu"
When /^I expose the navigation menu$/ do
# @driver.clickOnActionBarHomeButton # Doesn't work...NPE
# @driver.clickOnActionBarHomeButton({:target => 'Robotium'}) #Doesn't work...NPE
# @driver.click_on_action_bar_item('android.R.id.home') # Doesn't work...string vs res int
# @driver.click_on_action_bar_home_button() #Doesn't work...NPE
@driver.click_on_action_bar_home_button #Doesn't work...NPE
end
@patrickhammond
Copy link
Author

Updated BrazenHead com.leandog.brazenhead.commands.CommandRunner method to dump informative information to logcat.

public void execute(final Command... commands) throws Exception {
clearLastRun();

    for (final Command command : commands) {
        try {
            theLastResult = findMethod(command).invoke(theTargetFor(command), theArguments(command));
        } catch (InvocationTargetException ex) {
            Log.e("CommandRunner", "Error while trying to invoke the method " + command.getName(), ex);
            throw ex;
        }

        if (command.hasVariable()) {
            storeVariable(command);
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment