diff --git a/lib/korap_rc.js b/lib/korap_rc.js
new file mode 100644
index 0000000..c5356b8
--- /dev/null
+++ b/lib/korap_rc.js
@@ -0,0 +1,73 @@
+var chai = require('chai');
+var should = chai.should();
+var assert = chai.assert;
+
+class KorAPRC {
+    korap_url = ""
+
+    constructor(korap_url) {
+        this.korap_url = korap_url
+    }
+
+    static new(korap_url) {
+        return new KorAPRC(korap_url)
+    }
+
+    async login(page, username, password) {
+        await page.goto(this.korap_url, { waitUntil: 'networkidle0' });
+        const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
+
+        if (username_field != null) {
+            await username_field.type(username);
+            await page.keyboard.press("Tab")
+            await page.keyboard.type(password)
+            await page.keyboard.press("Enter")
+        }
+
+        await page.waitForNavigation({ waitUntil: 'networkidle2' });
+        const logout = await page.$("body > header > div > a[class=logout]")
+        if (logout == null) {
+            return false
+        }
+
+        let value = await page.evaluate(logout => logout.textContent, logout)
+        if (!value.match(/(Abmelden|Logout)/)) {
+            return false
+        }
+        return true
+    }
+
+    async search(page, query) {
+        const query_field = await page.$("body > header > form > div > input[name=q]")
+        assert.notEqual(query_field, null)
+        await query_field.type(query)
+        await page.keyboard.press("Enter")
+        await page.waitForNavigation();
+        const total_results = await page.$("#total-results")
+        assert.notEqual(total_results, null, "cannot find total results")
+        const hits = Number(await page.evaluate(total_results => total_results.textContent, total_results))
+        return hits
+    }
+
+    async logout(page) {
+        const logout_button = await page.$("a[class=logout]")
+        if (logout_button == null) {
+            return false
+        }
+        await page.click("a[class=logout]")
+        const username_field = await page.$("body > aside > div > fieldset > form > input[type=text]")
+        assert.notEqual(username_field, null)
+        return true
+    }
+
+    async assure_glimpse_off(page) {
+        const glimpse = await page.$("input[name=cutoff]")
+        const glimpse_value = await (await glimpse.getProperty('checked')).jsonValue()
+        if (glimpse_value) {
+            await page.click("#glimpse")
+        }
+
+    }
+}
+
+module.exports = KorAPRC
