OSX 10.10.1, Xcode 6.1.1, Appium 1.3.4, iOS 8.1 iPad 2 simulator, using Ruby
Some of the times when I call button it returns an instruments error on some strings. The buttons are visible, and they appear in the inspector just fine. Here’s some examples
If I call button(“Allow photo access”) it works fine
If I call button(“iPad Case”) I get this error in the appium server log:
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {"status":17,"value":"undefined is not a function (evaluating 'elementProperty.toLowerCase()')"}
info: [debug] Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"undefined is not a function (evaluating 'elementProperty.toLowerCase()')"},"sessionId":"33fc2405-4b35-4eeb-a58b-008c792f17db"}
info: <-- POST /wd/hub/session/33fc2405-4b35-4eeb-a58b-008c792f17db/execute 500 468.671 ms - 233
If I call button_exact(“iPad Case”) the method works. Obviously it has something to do with calling .toLowerCase on the string. At first I thought it had something to do with special characters, as I first noticed the error popping up when calling button on a string that had a / within the string, but it seems to happen on some buttons with just letters in the string.
Just some additional info using _by _json as such:
_by_json({typeArray: ["UIAButton"], onlyFirst: true, onlyVisible: true, name:{target: "iPad Case", substring: true, insensitive: true}})
returns the button where button(“iPad Case”) failed
looks like this error is caused by using the current appium_lib from git rather than the gem from rubygems
1 Like
Same is happening to me and I have all updated:
ios8.1.3
iphone5
xcode6.1.1
appium_lib 6.0.0
[1] pry(main)> buttons("dhd")
post /execute
{
:script => " (function() {\n var opts = {\"typeArray\":[\"UIAButton\"],\"onlyVisible\":true,\"name\":{\"target\":\"dhd\",\"substring\":true,\"insensitive\":true},\"label\":{\"target\":\"dhd\",\"substring\":true,\"insensitive\":true},\"value\":{\"target\":\"dhd\",\"substring\":true,\"insensitive\":true},\"onlyFirst\":false}\n\n return $.mainWindow()._elementOrElementsByType(opts);\n })();\n"
}
Selenium::WebDriver::Error::JavascriptError: undefined is not a function (evaluating 'elementProperty.toLowerCase()')
from /Users/wcs_mac/.rvm/gems/ruby-2.1.2/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
This issue continues to affect me on every button or buttons. And I find very strange that something so big would only affect me.
Any tip on what I might do/change in order to stop this issue from happening to me?
Edit: Just updated ruby to 2.2.0 and reinstalled all gems, etc… and same error