WKZombie icon indicating copy to clipboard operation
WKZombie copied to clipboard

Get HTML of current page.

Open fishfisher opened this issue 7 years ago • 2 comments

I'm playing around with WKZombie and I must say I enjoy it a lot! Great work. A few questions have come up and I'm wondering if I could get some input.

  • What is the best/ most efficient way to get all the HTML of the current page?

I have tried inspect >>> execute("document.documentElement.outerHTML.toString()") where I evaluate the JavaScriptResult, but it's not ideal.

  • When I use execute does it disregard the wait time for previous Action? I.e:

                  `
                  >>> click(then: .wait(10.0))
                  >>> execute("document.documentElement.outerHTML.toString()")
                  `
    

In the above example the JavaScriptResult is nil. My guess is because the previous >>> get was a href and is not a document? How can I reference the page after a click?

  • If I'm logging in to a website and get an element by ID it works fine. If I later want to get another element I am struggeling to find a good way to run a similar operation. I.e: If the webView is already logged in the login sequence will fail as the login form does not exist. What is the best way to identify that the webView is already logged in?

  • How does WKZombie handle input values containing special characters? I'm thinking especially of the backslash (\) character.

Thanks!

fishfisher avatar May 02 '17 14:05 fishfisher

if you call >>> browser.inspect() === processPage

func processPage(result: HTMLPage?) { result.description // this is your full html }

avisual avatar Aug 13 '17 21:08 avisual

As to validating if you are logged in, you will need to do this by checking the page for something show you that you are logged in

avisual avatar Aug 13 '17 21:08 avisual