WKZombie
WKZombie copied to clipboard
Button NIL even though Get returns the Button
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)")
}