0

動作を使用してセレン テストを実行しようとしていますが、そのアイデアの開始時に行き詰まっています。私はpython、seleniumをセットアップし、本来あるべきように動作しました。問題なくセレンでpythonスクリプトを実行しています。私の問題は、振る舞いで実行しようとすると始まります。私のpythonは3.5.2、セレンは2.53.2、ビヘイビアは1.2.5です。機能ファイルを実行しようとすると、以下のエラーが発生します。PyCharm IDE で実行しようとしても、コマンド プロンプトから直接実行しようとしても問題ありません。何が間違っているのか、何が間違っているのか、誰にも手がかりがありますか?

エラー:

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 で終了しました

4

1 に答える 1

3

トレースバックは次を返します:「IndentationError: unindent は、どの外側のインデント レベルとも一致しません」。

これは通常、インデント レベルのタブ/スペースが正しくないことを示しています。
ファイルのタブを 4 つのスペースに再フォーマットしてみていただけますか?

khelwood が指摘したように、注目すべきファイルは 11 行目あたりの「features\environment.py」です。

通常、これでこの問題は解決します。

于 2016-07-07T09:13:49.310 に答える