Python尝试运行behavior get errors

2024-05-15 03:07:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用behave来运行selenium测试,但我在这个想法的开始就被卡住了。 我已经设置了python,selenium,并按照它应该的方式运行。我用selenium运行python脚本没有问题。当我试着用行为来管理他们时,我的问题就开始了。我的python是3.5.2,selenium是2.53.2,behavior是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


Tags: runinpyseleniumlinefilesprogramx86
1条回答
网友
1楼 · 发布于 2024-05-15 03:07:08

回溯返回:“IndentationError:unident不匹配任何外部缩进级别”。在

这通常表示缩进级别的制表符/空格不正确。
你能试着重新格式化文件标签到4个空格吗?在

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

这通常可以解决这个问题。在

相关问题 更多 >

    热门问题