Ask a Question

Find Child Method -Doing 2 different Things

Frequent Contributor

Find Child Method -Doing 2 different Things

In the code below = I am able to click on the object Consistently however when Ito write it to the log it "errors" on the  else statement as if the object does not exist. 

It seems like I am doing the same thing twice and getting a different result.

def CheckRequestPersonEnhanced():
myChRequest = ' '
PropArray = ["ObjectType","contentText"]
ValuesArray = ["Link","Browse Check Request - Person"];
browser = Aliases.browser
page = browser.Page("*")
page.FindChild(PropArray, ValuesArray,10).click()
myChRequest = page.FindChild(PropArray, ValuesArray,10)
if (myChRequest.exists):
Log.Message("Success Check Detail")
Log.Message("Processing Exemptions")
sPath = "C:\\Users\\Schofem\\Logs\\BadChecks.txt"
# Creates a text file at the specified location
# Opens the created file for writing
myFile = aqFile.OpenTextFile(sPath, aqFile.faWrite, aqFile.ctUnicode)
# Writes text to the file
# myFile.WriteLine(DDT.CurrentDriver.Value[0])
# myFile.WriteLine(DDT.CurrentDriver.Value[26])
# myFile.WriteLine(DDT.CurrentDriver.Value[27])

Community Hero



page.FindChild(PropArray, ValuesArray,10).click()

What happens in the tested application, especially, with the link been clicked, after the click?

If the link is removed from the page then subsequent .FindChild() will not find it and test code will proceed to the 'else:' block.


  /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.
Frequent Contributor

Sorry to be remiss as I get working on other things. In the application the click works fine and then it goes into the else. 
I I can run it 20 times and it will work correctly most of the time and then it errors. Specifically -it clicks the ling and capriciously errors

Showing results for 
Search instead for 
Did you mean: