I am Working On Web testing In Test Complete With Python Script.
1. I Have Saved My XPath In Unit1
2. I Created An Method In unit2.
3.In The Unit2 Method i Used EvaluateXPath method.
4.Now I need to Call The Unit1 Savd XPath In To The EvaluateXPath()
inside those braces.
5. Please Tell Me How To Call Method From One Unit To Another Unit inside Those Braces
p = Sys.Browser("*").Page("*")
arr = p.EvaluateXPath(?..............Send Me the Answer For This Function)
Thank You For the repley But my method is different
arr = p.EvaluateXpath(......i need to call that unit 1 into this method.....)
i need that Xpath to Call inside Those Braces...
Pls Tell Me how To Do That...
But in the link it clears that how to call methos from one unit to other but not inside a method
I am not an expert with Python, but for me your example looks like that you would like to have public method or variable in Unit1 and use it from Unit2. If the method/variable is public, it does not matter if you use it inside braces or assign to a local variable and use this variable then.
So my current understanding is that you need to make some methods and/or variables in one unit to be public and then use them from another unit.
I think that the referenced article describes how this can be done.
Hi @Vimalan ,
in unit1 please specify the xpath as a string as mentioned below.
strSubmitButton = '//button[contains(@type, "submit")]'
in unit2 import the unit1 and use the string mentioned in unit1 as mentioned below.
import Unit1 def testingXpath(): page = Sys.Browser("chrome").Page("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_type") # Call the function arr = page.EvaluateXPath(Unit1.strSubmitButton) # Check the Object and highlight the object if GetVarType(arr) != varNull: Sys.HighlightObject(arr,2)
please do let me know if this resolved your problem.