Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button NIL even though Get returns the Button #79

Open
aaronfranco opened this issue Jan 29, 2018 · 0 comments
Open

Button NIL even though Get returns the Button #79

aaronfranco opened this issue Jan 29, 2018 · 0 comments

Comments

@aaronfranco
Copy link

 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)")
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant