Retrieve json from a website after login on webview

Hi CodeCrew, I am working on an app which involves pulling course information from student’s portal. On the user’s side:

  1. Student is brought to a webview showing the login page from university’s website. (
  2. Student puts in the credentials (Utorid and password), clicks login, webview is closed, and student is brought back to the app and will see his/her courses nicely imported and arranged.

Meanwhile, the app should:

  1. Go into user’s personal portal page upon successful login and take the user back to app while process the following in background
  2. Click on “Enrol & Manage” in the left sidebar (not sure if it is necessary, but when I view the source on my browser upon login, sometimes XHRs folder doesn’t show unless click on that link)
  3. Go to XHRs folder and find the json “enrolledCourses” (
  4. Retrieve and parse the user’s course info and make them available for the app

Source view when student just logged in:

Source view when student click on “Enrol & Manage” in the left sidebar, as you can see now “XHRs” is displayed:

The file “enrolledCourses” in “XHRs” which contains the course information:

Here’s my code for the ViewController so far:

import UIKit
import HTMLKit
import WebKit

class UtoridViewController: UIViewController, WKNavigationDelegate {
    private let webView: WKWebView = {
        let webView_result = WKWebView(frame: .zero)
        return webView_result

    override func viewDidLoad() {
        print("Acorn loading")
        webView.frame = view.bounds
        webView.navigationDelegate = self
        // Covert URL_string into URL
        guard let url = URL(string: Constants.ACORN_URL) else {
        webView.load(URLRequest(url: url))

extension ViewController: WKNavigationDelegate {
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!){

So far, I can get the user to the website, but I have no idea how to proceed…
Any help or guidance will be appreciated! Thanks in advance!!!