cancel
Showing results for 
Search instead for 
Did you mean: 

How to add python module in test complete

SOLVED
Occasional Contributor

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? 

1 ACCEPTED SOLUTION

Accepted Solutions
Valued Contributor

Re: 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.   

4 REPLIES 4
Highlighted
Community Hero

Re: How to add python module in test complete

Have you followed the documentation on importing 3rd party Python packages into TestComplete automation?

https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html#importing-packages


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
Valued Contributor

Re: 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.   

Contributor

Re: How to add python module in 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.

Community Hero

Re: How to add python module in test complete

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Watch the new interview