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

Submit form doesn't work #76

Open
Wiingaard opened this issue Dec 2, 2017 · 1 comment
Open

Submit form doesn't work #76

Wiingaard opened this issue Dec 2, 2017 · 1 comment

Comments

@Wiingaard
Copy link

Wiingaard commented Dec 2, 2017

Hey,
I'm planning to use WKZombie in an upcoming project. I'm trying to login to a website, by setting the value attributes of some input elements and submit a form. I Have experience as an iOS developer, but I'm quite new to the web development (HTML/CSS/Javascript), so maybe I'm misunderstanding something. I'm using the same process as the WKZombie Demo Application.

let action = open(loginUrl)
    >>* get(by: SearchType.id("m_Content_username2"))
    >>> setAttribute("value", value: credentials.username)
    >>* get(by: SearchType.id("password2"))
    >>> setAttribute("value", value: credentials.password)
    >>* get(by: SearchType.id("aspnetForm"))
    >>> submit(then: PostAction.wait(3.0))
    >>* get(by: SearchType.id("s_m_HeaderContent_picctrlthumbimage"))
        
action.start { (result) in
    print(result)
}

This gives me the following Log:

REQUEST
https://www.lectio.dk/lectio/163/login.aspx
[....]

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

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

SCRIPT
document.getElementById('aspnetForm').submit();
[..................................]

It find all elements and sets the right attributes. When it's has submitted the form and waited for 3 seconds, it can't find the last element. When looking at the snapshots, I see that the attributes get set right, but on the last screenshot I see that the browser is still on the login page, with the password reset. I sure it's the right credentials. It seems that the form isn't submitted right. The printet result is "Element Not Found".
Here is the HTML of the form:

<form method="post" action="./login.aspx" onsubmit="javascript:return WebForm_OnSubmit();" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'm_defaultformbtn')" id="aspnetForm" class="ls-master-container2" autocomplete="off">
<!— Lots of HTML and stuff —>
</form>

I've also tried:

  • with a local instance of WKZombie, but with same result.
  • to execute the JavaScript, by running execute("WebForm_OnSubmit()"). The JavaScript result was a Success, but I could seem to go on from there. How would I load the following page?
  • finding the Login-button element and running click, but doesn't work either. It is executing for a while, and the I get the "Cancelling Rendering"-error.

This might not be an issue with WKZombie, but any clues would be much appreciated!! :)
Great work with this project 👍

@MasterSwift
Copy link

MasterSwift commented Jun 6, 2018

Have you figured this out @Wiingaard ? If you are working with a website built with asp , it may be the cause of the error. check https://github.com/dejanstojanovic/MVC-Honeypot . let me know if you find a solution!

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