I do have the following folder structure for python scripts.
From Python I can run a script in folder Feed2Scripts as follows. Can this be possible in Robot Frame Work through imported libraries? > Note that I have common scripts in ‘GeneralScripts’ used by all other scripts in different folders
../Scripts>python –m Feed2Scripts.Script1 param1
If I just import Feed2Scripts/Script1.py as a library in RF, then It is failing to load libraries defined 'GeneralScripts'
First you set your python path on RIDE's Tools->Preferences->Importing Pythonpath so it does include your library and all its dependencies (imported modules and so on), like this:
(If your library is distributed via PIP, just pip install my_library_package_name instead, on the same environment you are running Robotframework/RIDE)
Then you can add the library to your test suite on the add library dialog you can open by pressing the library button on the Edit tab you can see when you select the suite:
After that, all keywords defined in your library will be available for use in any test of the test suite. You will see a Library import sentence on the Settings section of the header of your suite's code (On your text editor or RIDE's Text Edit tab of the suite:
Sometimes RIDE doesn't recognize the keywords on a recently added or modified library right away. In that case, Save all (CTRL+SHIFT+S) and restart RIDE to fix the issue.
Also, watch out for the library entry showing up in red on the suite import list on RIDE's Edit tab; it means something went wrong when trying to import the library. If you need to know what, you can find the trace on RIDE's Tools->View Ride Log.
Related
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *
for this code, I get the following error
JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
I am doing this through anaconda, in jupyter notebook. I am trying to get the workbook from aspose cell.
It seems configuration issue. Try to setup your environment properly. Make sure to install Java and setup JAVA_HOME and Path environment variables accordingly, see the document on how to setup environment and installation to use Aspose.Cells for Python via Java for your reference. You may also post your queries in the dedicated section.
PS. I am working as Support developer/ Evangelist at Aspose.
Below image is the sample reference of the robot code I have written. I have imported Selenium2Library, there were no errors but in test case section of Robot framework its not getting recognized.
Sample Robot Code
clearly, under settings section, we see that the library selenium2library is not being recognized?
I hope you have installed the "robotframework-selenium2library". if not, please use the following pip command
pip install robotframework-selenium2library
I have referred your image and I could see there is a syntax error while you import a library.
In Robot test file settings sections, while importing a library the syntax should be
Library YouDesiredLibrary
In this case it is
Library Selenium2Library
Once you are done with all the imports you have the define any variables you want to use for your test case which you have done correctly.
In the test cases Table/section
You need to call open the URL, you need to user Open Browser keyword with browser name and URL ans arguments
Please try this and let me know.
I'm trying to set up a python like environment with Atom-editor on a Linux machine.
I find the autocomplete-python package that uses jedi.
In the settings of the package I tried to add some python path where the APIs are (/usr/lib/python2.7/dist-packages/) but then the autocompletion doesn't recognize these libraries (for example the PyQt ones)
Am I missing something?
For anybody having the same issue please look here.
Basically everything should work out of the box, but if it does not -- try to configure path to python executable with which you have installed your external module. If it's still fails to complete -- try to configure extra path to python modules. (usually your site-packages directory)
I'm trying to get PyQt5 working with WinPython. PyQt5 comes with a readme file for installation, and I have unsuccessfully tried a few combinations of what I thought the first part of the readme tells me to do.
I have:
Windows 7 Home Premium 64-bit
WinPython-64bit-2.7.9.1
Qt 5.4
PyQt-gpl-5.4
PyQt-gpl-5.4 is in the folder (only partially sure that this is where I should have put it)
C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\Lib\site-packages\PyQt-gpl-5.4
My current attempt at getting everything working is: I'm trying to run the configure.py file in PyQt-gpl-5.4, but when I do so I consistently get the following error:
Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.6.
Make sure the correct version of qmake is on your PATH.
What I think is the required version of qmake being referred to is in the folder
C:\Qt\5.4\mingw491_32\bin
However, I have no idea how to fix the error by adding the qmake in this folder to PATH. My most recent attempt was to add the folder using Spyder's Tools->PYTHONPATH manager, but this made no difference. I also tried adding it using sys.path.append('C:\Qt\5.4\mingw491_32\bin'), but this didn't work either. I have since removed the folder name from both of these locations.
How do I get PyQt5 working with WinPython-64bit-2.7.9.1, or I think equivalently, how to I get the configure.py file in the PyQt-gpl-5.4 folder to run?
Thanks.
You definitely don't want the source code (i.e. PyQt-gpl-5.4) in the site-packages folder, because that's where the compiled modules will end up. Instead, it should just go in a temporary folder whilst you compile it.
When you run configure.py, you must take care to use the executable for the specific python that you are targeting. I do not know anything about WinPython, but for a normal python installation this means doing something like this:
C:\Python34\python configure.py
As a first step, before attempting to actually compile anything, it would be advisable to take at look at all the configuration options that are available, like this:
C:\Python34\python configure.py --help
(There's also the Installing PyQt5 section in the PyQt Docs).
This will tell you, for instance, that the simplest way to specify the Qt installation you are targeting would be something like this:
C:\Python34\python configure.py --qmake C:\Qt\5.4\mingw491_32\bin\qmake
EDIT:
Sorry, that last part is wrong: the --qmake option isn't available on Windows, so you have to add the directory containing the qmake executable to your PATH. This can be done with the following command:
set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin
I want to use keywords written in DateTime Library
http://robotframework.googlecode.com/hg/doc/libraries/DateTime.html?r=2.8.5
I have robot framework 2.8.6.
Whenever I import this library in my tests in RIDE; it is shown in red (not resolved). Also in documentation I am not able to search the keywords.
Your problem is probably with RIDE and not Robot Framework. RIDE uses its own copy of RF regardless of what you have installed. The included version is out of date. Try copying DateTime.py from Robot Framework installation to the folder in RIDE.
For example, copy C:\apps\Python27\Lib\site-packages\robot\libraries\DateTime.py to
C:\apps\Python27\Lib\site-packages\robotide\lib\robot\libraries
Then restart RIDE.
ombre42 is right, RIDE (my current is 1.3.0) includes an older version of RobotFramework which does not includes DateTime module. You have the RobotFramework 2.8.6 installed, but you doesn't use it when you launch tests using RobotFramework-RIDE.
Two important things:
Copy DateTime.py from your RobotFramework 2.8.6 as ombre42 said, but don't import DateTime using pip: it will work but you'll not get the RobotFramework's one (which is better and documented).
When you run your tests outside of RIDE, in a Jenkins environment for example, you'll probably use the RobotFramework 2.8.6 (or later) and not the same as your RIDE environment.
I'm use RF with Python and by default my IDE sees Python DateTime library.
Use full path:
Library robot.libraries.DateTime