I've done a decent amount of work in Java (enough to say I'm literate), and only started learning Python because my company works in Python-based Robot Framework. However, I'm starting to realize that certain things that are elementary in Java are (seemingly, allowing for lack of experience) quite difficult in Python. Is it possible, if so how, to do one of the following things:
- A: Call a Java-based Robot Framework library in the
*** Settings ***section, along with my Python-based libraries, or... - B: Call a Python-based keyword in Robot Framework, which then allows me to call Java-based keywords in another file?
Here is approximately what I'm looking to do for option A:
*** Settings ***
Library MyPythonLibrary.py
Library MyJavaLibrary.java
Here is the Robot Framework side of what I'm looking to do for option B:
*** Settings ***
Library JavaPythonIntegratingLibrary
Here's the bulk of the Python side of what I'm looking to do for option B:
class JavaPythonIntegratingLibrary(object):
def __init__(self):
self.selenium_lib = BuiltIn().get_library_instance('ExtendedSelenium2Library')
def java_keyword_name_1(self, *otherinputs):
# This is where I'd put the code to execute Java code, which would return a boolean argument for pass/fail.
if pass == True:
BuiltIn().pass_execution()
else:
BuiltIn().fail()
I found JPype, the accepted answer to the only (with allowance for duplicate questions) other question like this, but JPype doesn't seem to be usable for Python 2.7.13, the version my company uses. Jython is not viable as my company is pretty set on Python 2.7.13 as the base for their Robot Framework.
I realize that this question treads very close to the line of "recommend or find a book, tool, software library, tutorial or other off-site resource", so if this can be accomplished through Robot Framework, Python, or Java with a simple "this is how I'd fill in the blanks", then that is the answer that I would prefer. If it cannot, or if you think that this question is getting a little too close to that line and you can recommend a better site to take this question to, I won't be offended and the question can be moved to that site.