Skip to content

Commit

Permalink
Don't crash when mainWindow is UIAElementNil
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline committed Mar 5, 2015
1 parent ef9cc99 commit f2122de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/appium_lib/ios/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,13 @@ def _by_json opts
# will be present.
_validate_object opts[:name], opts[:label], opts[:value]

# note that mainWindow is sometimes nil so it's passed as a param
# $._elementOrElementsByType will validate that the window isn't nil
element_or_elements_by_type = <<-JS
(function() {
var opts = #{opts.to_json}
var opts = #{opts.to_json};
return $.mainWindow()._elementOrElementsByType(opts);
return $._elementOrElementsByType($.mainWindow(), opts);
})();
JS

Expand Down

0 comments on commit f2122de

Please sign in to comment.