Forum Discussion

sunrays123's avatar
sunrays123
Occasional Contributor
7 years ago

How to add python module in test complete

I need to use requests module in my python script to scraping HTML data with XPath. I am getting ModuleNotFound error when import requests module.

 

Could anyone please tell me how to add python module in test complete? 

  • You should put your external libraries in python lib in testcomplete 

    eg 

    C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib

    If you have other python installations in your machine, just installing (eg via pip command) will not effect to python inside test complete.   

  • NisHera's avatar
    NisHera
    Valued Contributor

    You should put your external libraries in python lib in testcomplete 

    eg 

    C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib

    If you have other python installations in your machine, just installing (eg via pip command) will not effect to python inside test complete.   

  • Can anyone elobrate in more detail?

     

    from os import sys
    sys.path.insert(0, '%PATH_TO_PYTHON_DIRECTORY%\Lib\site-packages') import requests

    But the TC tool showing an error 'No module named 'requests'. 

    So how to import packages, please let me know with an example or else syntax in detail.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Documentation linked further up as well as explanation of where you need to put your "requests" module for TestComplete to be able to read it.