Skip to content

Robot Framework Remote Library for PhantomJS

Notifications You must be signed in to change notification settings

tisto/phantomrobot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhantomJS Remote Library for Robot Framework

This is a proof-of-concept PhantomJS integration for Robot Framework.

This package provides an XML-RPC-service, which implements Robot Framework's remote library API and relays its commands to PhantomJS using WebSocket.

Disclaimer: To be complete enough to be useful, the library should contain implementations for the same keywords as SeleniumLibrary. Yet, I'm not sure if that's worth of the effort. Maybe one should just implement Selenium WebDriver Wire Protocol instead...

This borrows many ideas from RoboZombie – a similar proof-of-concept remote library for Zombie.js.

Requirements

  • PhantomJS available on path
  • node.js and npm with
    • xmlrpc
    • socket.io
    • optimist and
    • coffee-script -modules installed
  • make to run Makefile

Usage

  1. Launch phantomrobot onto background by node phantomrobot.js.
  2. Run a Robot Framework -testsuite (e.g. pybot testsuite.txt).

Arguments

--port=1337
a local port number for this Robot Framework remote library (PhantomJS will connect to phantomrobot through port + 1, e.g. 1338)
--implicit-wait=10
implicit timeout for certain keywords, e.g. "page contains"; disable with implicit-wait=-1
--implicit-sleep=1
time to sleep between trials until implicit timeout
--screenshots-dir=
full path to directory to save screenshot of test failures (defaults to the parent of the PhantomJS' working directory)

An example of use

I'm developing and testing this with Plone, which is usually put together using buildout as follows...

A pybot-buildout

[buildout]
extends = buildout.cfg
find-links += http://packages.affinitic.be/simple
allow-hosts +=
    robotframework.googlecode.com
    robotframework.org
    code.google.com
    selenium.googlecode.com
    seleniumhq.org
    www.openqa.org
    packages.affinitic.be
parts += robot

[versions]
robotframework = 2.5.7-st1

[robot]
recipe = zc.recipe.egg
eggs = robotframework

An example test suite

*** Settings ***
Library  Remote  http://localhost:1337/

Suite Setup  Start browser
Suite Teardown  Close browser

*** Variables ***

*** Test cases ***

Plone Accessibility
    Goto homepage
    Click link  Accessibility
    Page should contain  Accessibility

Plone Log In
    Go to  http://localhost:8080/Plone/login_form
    Page should contain element  __ac_name
    Input text  __ac_name  admin
    Input text  __ac_password  admin
    Click Button  Log in
    Page should contain  now logged in
    click link  Continue to the Plone site home page
    Page should contain  Manage portlets


*** Keywords ***

Start browser
    Open browser  http://localhost:8080/Plone/

Goto homepage
    Go to  http://localhost:8080/Plone/
    Page should contain  Plone site

About

Robot Framework Remote Library for PhantomJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published