Skip to content

Button NIL even though Get returns the Button #79

Description

@aaronfranco
 let url = URL(string: "http://192.168.2.5")!
        open(then: .wait(10.0))(url)
    >>> get(by: .id("UserName"))
    >>> setAttribute("value", value: "xxx")
    >>> get(by: .id("Password"))
    >>> setAttribute("value", value: "xyz")
    >>> get(by: .class("submitBtn"))
    >>> press(then: .wait(10.0))
    === { (apage: HTMLPage?) in
            print("\(apage)")
        }

this returns "nil" and I cannot figure out why. When I look at the logs, it says the node was nil.

SCRIPT
getElementByXpath("//*[@id='UserName']").setAttribute("value", "xxx"); document.documentElement.outerHTML;
[.]

SCRIPT
getElementByXpath("//*[@id='Password']").setAttribute("value", "xyz"); document.documentElement.outerHTML;
[]

nil

The following code fetches the submit button just fine, which is why I'm surprised the snippet above doesn't work. What am I missing?

 let url = URL(string: "http://192.168.2.5")!
        open(then: .wait(10.0))(url)
    >>> get(by: .id("UserName"))
    >>> setAttribute("value", value: "xxx")
    >>> get(by: .id("Password"))
    >>> setAttribute("value", value: "xyz")
    >>> get(by: .class("submitBtn"))
    === { (apage: HTMLElement?) in
            print("\(apage)")
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions