lovelysystems / robotframework-androidlibrary

Robot Framework Automation Library for Android
29 stars 22 forks source link

Problem with robotframework on ubuntu #37

Closed bialek-luk closed 11 years ago

bialek-luk commented 11 years ago

After recent ubuntu updates i get Android keywords stopped wroking:

AndroidLibrary.Screen should contain text

results in

FAIL    TypeError: 'instancemethod' object has no attribute '__getitem__'

and by the way

AndroidLibrary.Capture Screenshot

FAIL    ConnectionError: HTTPConnectionPool(host='localhost', port=34777): Max retries exceeded with url: /screenshot (Caused by <class 'httplib.BadStatusLine'>: '')

I have python2.7.3 installed and about 2 weeks ago everything worked ok, but i think some package update might brake something. I've already reinstalled calabash, robotframework, robotframework-androidlibrary, requests... Could you at least give me a hint what may cause such errors?

bialek-luk commented 11 years ago

The output from first error is:

Timeout 1 minute exceeded. The last error was: TypeError: 'instancemethod' object has no attribute '__getitem__'

The application tested is up and running on the emulator and the test fails.

peritus commented 11 years ago

Hey! Thanks for the bug report!

Could you run Robot Framework with the -L TRACE option to get more debug info and post that here ? Also: Which version of Ubuntu/Robot Framework/Python/this library are you using ? There could be multiple installations on your system so you need to figure out which one is actually used.

peritus commented 11 years ago

About the Capture Screenshot bug: That's most likely because the calabash testserver crashed in the background. You can obtain a logcat [ http://developer.android.com/tools/help/logcat.html ] output while executing the tests to see where it crashed — then either report a bug to calabash-android or fix the issue in the app you're testing. HTH.

bialek-luk commented 11 years ago

Thanks for your reply. My packages:

Ubuntu 12.04 Python 2.7.3 robotframework-2.7.5 calabash-android 0.3.2 robotframework-androidlibrary-0.1.16

Failing keywords:

KEYWORD: AndroidLibrary.Screen Should Contain OpenID Login Documentation:
Asserts that the current screen contains a given text Start / End / Elapsed: 20121220 12:17:32.961 / 20121220 12:17:33.998 / 00:00:01.037 12:17:32.961 TRACE Arguments: [ u'OpenID Login' ] 12:17:32.961 DEBUG >> '{"command": "assert_text", "arguments": ["OpenID Login", true]}' 12:17:32.961 DEBUG >> () {'headers': {'Content-Type': 'application/json'}, 'data': '{"command": "assert_text", "arguments": ["OpenID Login", true]}'} 12:17:32.962 INFO Starting new HTTP connection (1): localhost 12:17:33.997 DEBUG "POST / HTTP/1.1" 200 None 12:17:33.997 WARN << 'http://localhost:34777/' 12:17:33.997 WARN << u'{"bonusInformation":[],"message":"","success":true}' 12:17:33.998 FAIL TypeError: 'instancemethod' object has no attribute 'getitem' 12:17:33.998 DEBUG Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/AndroidLibrary/init.py", line 457, in screen_should_contain assert result["success"] is True, "Screen does not contain text '%s': %s" % (

KEYWORD: AndroidLibrary.Capture Screenshot Documentation:
Captures a screenshot of the current screen and embeds it in the test report Start / End / Elapsed: 20121220 12:18:33.077 / 20121220 12:18:33.624 / 00:00:00.547 12:18:33.077 TRACE Arguments: [ ] 12:18:33.077 DEBUG >> () {} 12:18:33.078 INFO Starting new HTTP connection (1): localhost 12:18:33.623 FAIL ConnectionError: HTTPConnectionPool(host='localhost', port=34777): Max retries exceeded with url: /screenshot (Caused by <class 'httplib.BadStatusLine'>: '') 12:18:33.624 DEBUG Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/AndroidLibrary/init.py", line 436, in capture_screenshot response = self._request("get", urljoin(self._url, 'screenshot')) File "/usr/local/lib/python2.7/dist-packages/AndroidLibrary/init.py", line 73, in _request response = getattr(requests, method)(url, _args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 49, in get return request('get', url, _kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 38, in request return session.request(method=method, url=url, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 262, in request resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 357, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 159, in send raise ConnectionError(e)

peritus commented 11 years ago

We've experienced this with older versions of calabash-android. You might want to upgrade that and try again.

bialek-luk commented 11 years ago

I solved this problem by downgrading python requests to version requests==0.14.2