Error while using Runner.CallMethod()
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2021
02:36 PM
05-20-2021
02:36 PM
Error while using Runner.CallMethod()
Hi Team,
i am using Python as Project script a Language, and i am trying to use Runner.CallMethod to execute a definition which is in a different routine, but i am getting error as "Python runtime error.Could not convert variant of type (Dispatch) into type (OleStr)"
i have used the import statements as well,
Please find the my below snippet and request you to please help me to resolve it
#Unit1
def testSample():
Log.Message("Automation")
import Unit1
def Executor():
strUnitName = "Unit1"
Runner.CallMethod(eval(str(strUnitName)+".testSample"))
request you to please help me to resolve this Problem.
Thanks and Regards,
Sathish K
Solved! Go to Solution.
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2021
12:28 AM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2021
12:37 AM
05-21-2021
12:37 AM
Thanks for your reply
And the below solutions resolved my problem:
exec("Unit1.testSample()") and eval("Unit1.testSample()")
Regards,
Sathish Kumar
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2021
01:20 PM
05-23-2021
01:20 PM
Hi,
I believe that
Runner.CallMethod(str(strUnitName)+".testSample")
should work as well.
Regards,
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
