selenium-webdriverpython-behave

The term 'behave' is not recognized as the name of a cmdlet, function


I have Python 3.10.7 with the follwing packgaes installed using pip install in command line: behave 1.2.6 selenium 4.4.3

These have also been added to the packagelist of the project using the project config in pycharm Also behave is in the systme path as well along with python.

I am trying to use the behave command but I am getting the following error:

behave : The term 'behave' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ behave features\myfeaturefile.feature

Following is my project directory: enter image description here

Following is my project in pycharm: enter image description here

I need help in fixing this problem as I am new to this tool. Thanks


Solution

  • First check if you have behave and python in the path variables. Check if you can execute the below command

    C:\demo>behave -h
    

    If this does not return a list of help commands associated with behave, this means that behave is not in the path variables

    Alternatively, you can check it via cmd using the "PATH" command. This will show you all the entries in the system path

    C:\demo>PATH
    PATH=C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin...
    

    If behave or python are not in the path variables, you can set them using

    set PATH=%PATH%;c:\PATH_TO_BEHAVE
    

    NOTE: Setting path using cmd is only valid till the time the cmd window is open. Once you close it, the path variable will be rest to original values.