Python – ElementTree- cannot use absolute path on element

Turns out I needed to say target.findall(".//StepText"). I guess anything without the ‘.’ is considered an absolute path?

Updated working code:

def search():
    root = ET.parse(INPUT_FILE_PATH)
    for target in root.findall("//Script"):
        stepTexts = target.findall(".//StepText")
        for stepText in stepTexts:
            if FIND.lower() in stepText.text.lower():
                print target.attrib['name'],' -- ',stepText.text

Leave a Comment

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.