GithubHelp home page GithubHelp logo

swhgoon / wookie-view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chaschev/wookie-view

1.0 2.0 0.0 532 KB

Mini-selenium which uses WebView from JavaFX.

License: Apache License 2.0

JavaScript 4.93% Scala 85.68% Java 5.97% CSS 2.41% HTML 1.01%

wookie-view's Introduction

wookie-view

WookieView is made to simplify WebView usage and replace Selenium in some of the tasks, maybe. With WookieView you can easily automatize web browsing operations like searching with Google Search, visiting your Facebook page with your login and password, crawling through a forum and downloading files.

WookieView is pure JDK, it uses a few Java libraries and could remind of lightweight Selenium.

Features

  • Concise syntax
  • JQuery support
  • Embedding scripts into existing pages (i.e. jQuery, Firebug, your manual JS scripts)
  • File downloads
  • Scala & Java 8 support
  • Simple plain script and event-driven API

How to open this project in IDE

To open a project in your IDE, just import it as a Maven project.

Code Examples

Code examples can be found in an example folder. Some few examples from there:

Search Google

load("http://www.google.com")

$("input[maxlength]")
  .value("wookie-view")
  .submit() // execution is blocked here during submit()

println("results: " + $("h3.r").asResultList)

Click 'Sign In' button at GitHub

$("a.button.signin").followLink()

Submit a form

// fill login data at the login page
$("#login_field").value(login)
$("#password").value(password)
  .submit()

Configuring the WookieView

WookieView wookieView = WookieView.newBuilder
    .useFirebug(false)
    .useJQuery(true)
    .createWebView(true)  // WookieView can be invisible
    .includeJsScript(io.Source.fromInputStream(getClass.getResourceAsStream("/wookie/downloadJDK.js")).mkString)
    .build()

Follow a link after a Google Search query

load("http://www.google.com")

$("input[maxlength]")
  .value("wookie-view")
  .submit()

System.out.println("results: " + $("h3.r").asResultList)

// get the list of result links with CSS selector,
// find a link in it and follow it
$("h3.r a").asResultList().find(_.text().contains("chaschev")).get.followLink()

Download a file (Scala)

addDownloadHook(new LocationMatcher(loc =>
    loc.contains("download.oracle.com") && loc.contains("?")
))
downloadLink.get.followLink()

Questions, etc

Just msg me or mail me, I will respond as quickly as I can.

Maven artifacts

I will publish this project to Maven Central if gets enough attention.

wookie-view's People

Contributors

chaschev avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.