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

Get HTML of current page. #62

Open
fishfisher opened this issue May 2, 2017 · 2 comments
Open

Get HTML of current page. #62

fishfisher opened this issue May 2, 2017 · 2 comments

Comments

@fishfisher
Copy link

fishfisher commented May 2, 2017

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!

@avisual
Copy link

avisual commented Aug 13, 2017

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

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

@avisual
Copy link

avisual commented Aug 13, 2017

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

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

2 participants