2016-07-07 57 views
0

私は振る舞いを使ってセレンテストを実行しようとしていますが、私はそのアイディアの始まりで立ち往生しています。 私はpython、seleniumをセットアップして、そのように動作します。私は問題なしでセレンでPythonスクリプトを実行しています。私の問題は、それらを動作させようとすると始まります。私のPythonは3.5.2で、セレンは2.53.2で、動作は1.2.5です。 機能ファイルを実行しようとすると、エラーが発生します。私がPyCharm IDEで、またはコマンドプロンプトから直接実行しようとしても問題はありません。誰が間違っているのか、私が間違っているのかを知っていますか?実行しようとしているPythonがエラーを返す

エラー: 'IndentationError:インデント解除は、任意の外側のインデントレベルと一致していない'

Traceback (most recent call last): 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 269, in <module> 
_BehaveRunner(my_config, base_dir).run() 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 92, in run 
number_of_tests = self._get_number_of_tests() 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 206, in _get_number_of_tests 
for feature in self._get_features_to_run(): 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 209, in _get_features_to_run 
self.__real_runner.run() 
    File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 672, in run 
    File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 677, in run_with_paths 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 92, in load_hooks 
super(_RunnerWrapper, self).load_hooks(filename) 
    File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 631, in load_hooks 
    File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 303, in exec_file 
    File "features\environment.py", line 11 
print("Before scenario\n") 
         ^
IndentationError: unindent does not match any outer indentation level 

プロセスは終了コード1つの

+1

あなたのインデントが "features \ environment.py"にねじ込まれていますか? – khelwood

答えて

3

あなたトレースバックリターンを終えました。

これは通常、インデントレベルのタブ/スペースが間違っていることを示す指標です。
ファイルのタブを4つのスペースに再フォーマットしてみることはできますか?

As khelwood noted, the file you should take a look at is 'features\environment.py' around line number 11.

これは通常、この問題を解決するはずです。

関連する問題