Browser Automation

Browser automation is a feature which allows you to automate processes online. This can be as simple as a simple button click to complex automated login and registration systems.

The Incogniton browser automation uses the selenium webdriver. Next to this we also support Puppeteer automation.

Supported languages #

At the moment only python is supported. The current implementation requires some additional settings to be set in python before launching a profile. Other languages like Java are on the roadmap.

Selenium with Incogniton #

To communicate with the selenium integration of Incogniton, two ports can be set.
One is the general API port and the other one is the specific selenium hub port.
The default API port is 35000 and the default selenium port is 4444.
The port values can be changed with the following steps:

  • Go to C:\Users\%username%\incogniton
  • Open auth.json
  • Change seleniumPort and apiPort to the desired port numbers

Python example #

from selenium import webdriver
from ast import literal_eval
import requests

incogniton_profile_id = 'xxxxx-xxxx-xxxx-xxxx-xxxxxxxx'
incogniton_url = 'http://127.0.0.1:35000/automation/launch/python/'+incogniton_profile_id

resp = requests.get(incogniton_url)
incomingJson = resp.json()

python_dict = literal_eval(incomingJson['dataDict'])
driver = webdriver.Remote(
			command_executor = incomingJson['url'],
			desired_capabilities = literal_eval(incomingJson['dataDict']) )

driver.get("https://www.incogniton.com")

Puppeteer with Incogniton #

Python example #

var request = require("request")
var incogniton_profile_id = 'xxxxx-xxxx-xxxx-xxxx-xxxxxxxx';
var url = "http://localhost:35000/automation/launch/puppeteer/" + incognitonProfileID;

request({
    url: url,
    json: true,
    headers: { 'Content-Type': 'application/json' }
}, function (error, response, body) {

    if (!error && response.statusCode === 200) {
      
      
        const puppeteer = require('puppeteer')
        const screenshot = 'booking_results.png'
        try {
          (async () => {
            const browserURL = body.puppeteerUrl;
            const browser = await puppeteer.connect({browserURL});
            //const browser = await puppeteer.launch()
            const page = await browser.newPage()
            await page.goto('https://hotmail.com')
            await page.screenshot({ path: screenshot })
            await browser.close()
            console.log('See screenshot: ' + screenshot)
          })()
        } catch (err) {
          console.error(err)
        }
    }
})

Powered by BetterDocs