Seleniumを使用して、 send_keysを使用してブラウザーインタラクションを実行しているマシンに960KBのファイルをアップロードしようとしていますが、ファイルは別のマシンに送信されています。現在、これは機能しておらず、以下のトレースバックを取得します。ただし、画像または小さなzipファイルがアップロードされている場合は機能します(したがって、他の人が問題を抱えていたzipファイルのアップロードに問題はないと思います)。投稿する前にトピックを検索しようとしました:
https://groups.google.com/forum/#!msg/selenium-users/dlxoowrZYeA/24kPjqRW2FcJ [1-25] http://grokbase.com/t/gg/selenium-developer-activity/124tpkyzmq/issue- 3812-in-selenium-python-cannot-upload-a-file
ただし、提案された編集を行った後でも、まだ機能していません。私はセレン2.25.0、centos 6.3オペレーティングシステム、Python2.6.6を使用しています
Traceback (most recent call last):
File "/home/testrunner/Suite/CATS/cobalt/cobalttest.py", line 270, in run
testMethod()
File "/home/testrunner/Suite/CATS/mhetest/psmBaseSetupModule.py", line 549, in runTest
PSM.command().find_element_by_name( 'location' ).send_keys( 'filename.tar.gz' )
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webelement.py", line 144, in send_keys
value = self._upload(local_file)
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webelement.py", line 228, in _upload
{'file': base64.encodestring(fp.getvalue())})['value']
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webelement.py", line 205, in _execute
return self._parent.execute(command, params)
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 283, in execute
return self._request(url, method=command_info[0], data=data)
File "/usr/lib/python2.6/site-packages/selenium/webdriver/remote/remote_connection.py", line 324, in _request
response = opener.open(request)
File "/usr/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1190, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1163, in do_open
r = h.getresponse()
File "/usr/lib/python2.6/httplib.py", line 990, in getresponse
response.begin()
File "/usr/lib/python2.6/httplib.py", line 391, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.6/httplib.py", line 355, in _read_status
**raise BadStatusLine(line)
BadStatusLine**