mkoehnke / WKZombie

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

=== problem

j-csc opened this issue · comments

commented

Hi,
I tried using WKZombie for this code

browser.open(url)

browser.get(by: .Id("Username"))
browser.setAttribute("value", value: username)
browser.get(by: .Id("Password"))
browser.setAttribute("value", value: password)
browser.get(by: .Id("site-login-form"))
browser.submit(then: .Wait(2.0))
browser.get(by: .Contains("href", "#studentmyday/schedule"))
browser.click(then: .Wait(2.0))
browser.getAll(by: .Id("accordionSchedules"))
=== handleResult

and it returns the error:
Binary operator '===' cannot be applied to operands of type 'Action<[HTMLElement]>' (aka 'Action<Array>') and '(Action<[HTMLTableRow]>) -> ()'

. All the methods are the same with the sample files and I am sure I have the update version. Any ideas?
Thanks!

Hi. I made some breaking changes to the === operator recently. Could you please try to change the signature of your handleResult function to this:

func handleResult(result: Result<[HTMLTableRow]>)

Hope that helps.

commented

yea that works, thanks a lot!

I found another problem with my test app and would really need some help.. so it went through and i did a browser.dump(). However I found out that it just fetched an HTML source file where the truncated tags are all missing..

for example the phone it loads

<body>
  <div id="app-style"></div>
  <div id="app" class="app-mobile-pusher"></div>
  <div id="__AjaxAntiForgery">
    <input name="__RequestVerificationToken" type="hidden" value="aHkiUeYthjno_QJwArziB-TEZDs2jPtKqZ1XMeGWXlVevzO5ck2t8wwWifkxkfkJ3DqqaS8lYBkxPBrv-tdLJzl1D8_c58cs633wlTNFYT01">
  </div>

but when I inspect the source code, there are html tags within

that I can't access through the WKzombie browser..

Any help would be appreciated!

Maybe you're trying to access the tags before the page loading (including JavaScript / Ajax) has completed? Did you try to increase the number of waiting seconds using the .Wait()-PostAction?

commented

Ah thanks, it worked!