~hrbrmstr/htmlunitjars

2d4f164ff031a62a54b224a1bf3459cf5826142a — hrbrmstr 4 years ago b5ff19e
2.36.0 + README
31 files changed, 90 insertions(+), 43 deletions(-)

M DESCRIPTION
M README.Rmd
M README.md
D inst/java/commons-text-1.6.jar
A inst/java/commons-text-1.7.jar
A inst/java/dec-0.1.2.jar
D inst/java/htmlunit-2.35.0.jar
A inst/java/htmlunit-2.36.0.jar
R inst/java/{htmlunit-core-js-2.35.0.jar => htmlunit-core-js-2.36.0.jar}
R inst/java/{htmlunit-cssparser-1.4.0.jar => htmlunit-cssparser-1.5.0.jar}
R inst/java/{httpclient-4.5.8.jar => httpclient-4.5.9.jar}
R inst/java/{httpmime-4.5.8.jar => httpmime-4.5.9.jar}
D inst/java/jetty-client-9.4.16.v20190411.jar
A inst/java/jetty-client-9.4.20.v20190813.jar
D inst/java/jetty-http-9.4.16.v20190411.jar
A inst/java/jetty-http-9.4.20.v20190813.jar
D inst/java/jetty-io-9.4.16.v20190411.jar
A inst/java/jetty-io-9.4.20.v20190813.jar
D inst/java/jetty-util-9.4.16.v20190411.jar
A inst/java/jetty-util-9.4.20.v20190813.jar
D inst/java/jetty-xml-9.4.16.v20190411.jar
A inst/java/jetty-xml-9.4.20.v20190813.jar
R inst/java/{neko-htmlunit-2.35.0.jar => neko-htmlunit-2.36.0.jar}
D inst/java/websocket-api-9.4.16.v20190411.jar
A inst/java/websocket-api-9.4.20.v20190813.jar
D inst/java/websocket-client-9.4.16.v20190411.jar
A inst/java/websocket-client-9.4.20.v20190813.jar
D inst/java/websocket-common-9.4.16.v20190411.jar
A inst/java/websocket-common-9.4.20.v20190813.jar
M java/htmlunit/Makefile
M java/htmlunit/pom.xml
M DESCRIPTION => DESCRIPTION +13 -6
@@ 1,17 1,24 @@
Package: htmlunitjars
Type: Package
Title: Java Archive Wrapper Supporting the 'htmlunit' Package
Version: 2.35.0
Date: 2019-04-27
Version: 2.36.0
Date: 2019-08-24
Authors@R: c(
    person("Bob", "Rudis", role = c("aut", "cre"), email = "bob@rud.is")
    person("Bob", "Rudis", role = c("aut", "cre"), email = "bob@rud.is"),
    person("Mike", "Bowlder", role = "aut", comment = "Original HtmlUnit Java author"),
    person("Ahmed", "Ashour", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("Brad", "Clarke", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("Marc", "Guillemot", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("Daniel", "Gredler", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("Sudhan", "Moghe", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("RBRi", "", role = "ctb", comment = "HtmlUnit Java contributor"),
    person("David K.", "Taylor", role = "ctb", comment = "HtmlUnit Java contributor")
  )
Maintainer: Bob Rudis <bob@rud.is>
SystemRequirements: Java
Description: Contents of the 'HtmlUnit' & supporting Java archives <http://htmlunit.sourceforge.net/>.
    Version number reflects the version number of the included 'JAR' file.
URL: https://github.com/hrbrmstr/htmlunitjars
BugReports: https://github.com/hrbrmstr/htmlunitjars/issues
URL: https://gitlab.com/hrbrmstr/htmlunitjars
BugReports: https://gitlab.com/hrbrmstr/htmlunitjars/issues
License: Apache License 2.0 | file LICENSE
Encoding: UTF-8
Suggests:

M README.Rmd => README.Rmd +26 -22
@@ 1,16 1,19 @@
---
output: rmarkdown::github_document
output: 
  rmarkdown::github_document:
    df_print: kable
---
```{r include=FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE)
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```
# htmlunitjars

Java Archive Wrapper Supporting the 'htmlunit' Package

## Description
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```

Contents of the `HtmlUnit` & supporting Java archives <http://htmlunit.sourceforge.net/>. Version number reflects the version number of the included 'JAR' file.
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```

>_`HtmlUnit` is a "GUI-Less browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser._
>


@@ 20,26 23,21 @@ Contents of the `HtmlUnit` & supporting Java archives <http://htmlunit.sourcefor
>
>_`HtmlUnit` is not a generic unit testing framework. It is specifically a way to simulate a browser._
    

## What's Inside The Tin

Everything necessary to use the HtmlUnit library directly via `rJava`.

`HtmlUnit` Library JavaDoc: <http://htmlunit.sourceforge.net/apidocs/index.html>
`HtmlUnit` Library JavaDoc: <https://htmlunit.sourceforge.net/apidocs/index.html>

## Installation

```{r eval=FALSE}
devtools::install_github("hrbrmstr/htmlunitjars")
```

```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```

## Usage

```{r message=FALSE, warning=FALSE, error=FALSE}
```{r lib, cache=FALSE}
library(htmlunitjars)

# current verison


@@ 51,7 49,7 @@ packageVersion("htmlunitjars")

`xml2::read_html()` cannot execute javascript so the traditional approach won't work:

```{r}
```{r go1}
library(rvest)

test_url <- "https://hrbrmstr.github.io/htmlunitjars/index.html"


@@ 65,13 63,13 @@ html_table(doc)

We _can_ do this with the classes from `HtmlUnit` proivided by this JAR wrapper package:

```{r}
```{r go2}
library(htmlunitjars)
```

Tell `HtmlUnit` to work like FireFox:

```{r}
```{r go3}
browsers <- J("com.gargoylesoftware.htmlunit.BrowserVersion")

wc <- new(J("com.gargoylesoftware.htmlunit.WebClient"), browsers$CHROME)


@@ 79,7 77,7 @@ wc <- new(J("com.gargoylesoftware.htmlunit.WebClient"), browsers$CHROME)

Tell it to wait for javascript to execute and not throw exceptions on page resource errors:

```{r}
```{r go4}
invisible(wc$waitForBackgroundJavaScriptStartingBefore(.jlong(2000L)))

wc_opts <- wc$getOptions()


@@ 89,7 87,7 @@ wc_opts$setThrowExceptionOnScriptError(FALSE)

Now, acccess the site again and get the table:

```{r}
```{r go5}
pg <- wc$getPage(test_url)

doc <- read_html(pg$asXml())


@@ 100,3 98,9 @@ html_table(doc)
No need for Selenium or Splash!

The ultimate goal is to have an `htmlunit` package that provides a nicer API than needing to know how to work with `rJava` directly.

## htmlunitjars Metrics

```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```

M README.md => README.md +46 -13
@@ 1,11 1,26 @@

[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Signed
by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr)
![Signed commit
%](https://img.shields.io/badge/Signed_Commits-85.7%25-lightgrey.svg)
[![Linux build
Status](https://travis-ci.org/hrbrmstr/htmlunitjars.svg?branch=master)](https://travis-ci.org/hrbrmstr/htmlunitjars)
[![Coverage
Status](https://codecov.io/gh/hrbrmstr/htmlunitjars/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/htmlunitjars)
![Minimal R
Version](https://img.shields.io/badge/R%3E%3D-3.2.0-blue.svg)
![License](https://img.shields.io/badge/License-Apache-blue.svg)

# htmlunitjars

Java Archive Wrapper Supporting the ‘htmlunit’ Package

## Description

Contents of the `HtmlUnit` & supporting Java archives
Contents of the ‘HtmlUnit’ & supporting Java archives
<http://htmlunit.sourceforge.net/>. Version number reflects the version
number of the included ‘JAR’ file.



@@ 30,14 45,25 @@ number of the included ‘JAR’ file.
Everything necessary to use the HtmlUnit library directly via `rJava`.

`HtmlUnit` Library JavaDoc:
<http://htmlunit.sourceforge.net/apidocs/index.html>
<https://htmlunit.sourceforge.net/apidocs/index.html>

## Installation

``` r
devtools::install_github("hrbrmstr/htmlunitjars")
install.packages("htmlunitjars", repos = "https://cinc.rud.is")
# or
remotes::install_git("https://git.rud.is/hrbrmstr/htmlunitjars.git")
# or
remotes::install_git("https://git.sr.ht/~hrbrmstr/htmlunitjars")
# or
remotes::install_gitlab("hrbrmstr/htmlunitjars")
# or
remotes::install_github("hrbrmstr/htmlunitjars")
```

NOTE: To use the ‘remotes’ install options you will need to have the
[{remotes} package](https://github.com/r-lib/remotes) installed.

## Usage

``` r


@@ 45,10 71,9 @@ library(htmlunitjars)

# current verison
packageVersion("htmlunitjars")
## [1] '2.36.0'
```

    ## [1] '2.34.0'

### Give It A Go

`xml2::read_html()` cannot execute javascript so the traditional


@@ 62,10 87,9 @@ test_url <- "https://hrbrmstr.github.io/htmlunitjars/index.html"
doc <- read_html(test_url)

html_table(doc)
## list()
```

    ## list()

☹️

We *can* do this with the classes from `HtmlUnit` proivided by this JAR


@@ 102,15 126,24 @@ pg <- wc$getPage(test_url)
doc <- read_html(pg$asXml())

html_table(doc)
## [[1]]
##      X1   X2
## 1   One  Two
## 2 Three Four
## 3  Five  Six
```

    ## [[1]]
    ##      X1   X2
    ## 1   One  Two
    ## 2 Three Four
    ## 3  Five  Six

No need for Selenium or Splash\!

The ultimate goal is to have an `htmlunit` package that provides a nicer
API than needing to know how to work with `rJava` directly.

## htmlunitjars Metrics

| Lang  | \# Files | (%) | LoC |  (%) | Blank lines |  (%) | \# Lines |  (%) |
| :---- | -------: | --: | --: | ---: | ----------: | ---: | -------: | ---: |
| Java  |        2 | 0.2 |  28 | 0.30 |           5 | 0.11 |       18 | 0.17 |
| Rmd   |        1 | 0.1 |  21 | 0.22 |          35 | 0.76 |       50 | 0.48 |
| Maven |        1 | 0.1 |  17 | 0.18 |           0 | 0.00 |        1 | 0.01 |
| R     |        5 | 0.5 |  15 | 0.16 |           1 | 0.02 |       36 | 0.34 |
| make  |        1 | 0.1 |  13 | 0.14 |           5 | 0.11 |        0 | 0.00 |

D inst/java/commons-text-1.6.jar => inst/java/commons-text-1.6.jar +0 -0
A inst/java/commons-text-1.7.jar => inst/java/commons-text-1.7.jar +0 -0
A inst/java/dec-0.1.2.jar => inst/java/dec-0.1.2.jar +0 -0
D inst/java/htmlunit-2.35.0.jar => inst/java/htmlunit-2.35.0.jar +0 -0
A inst/java/htmlunit-2.36.0.jar => inst/java/htmlunit-2.36.0.jar +0 -0
R inst/java/htmlunit-core-js-2.35.0.jar => inst/java/htmlunit-core-js-2.36.0.jar +0 -0
R inst/java/htmlunit-cssparser-1.4.0.jar => inst/java/htmlunit-cssparser-1.5.0.jar +0 -0
R inst/java/httpclient-4.5.8.jar => inst/java/httpclient-4.5.9.jar +0 -0
R inst/java/httpmime-4.5.8.jar => inst/java/httpmime-4.5.9.jar +0 -0
D inst/java/jetty-client-9.4.16.v20190411.jar => inst/java/jetty-client-9.4.16.v20190411.jar +0 -0
A inst/java/jetty-client-9.4.20.v20190813.jar => inst/java/jetty-client-9.4.20.v20190813.jar +0 -0
D inst/java/jetty-http-9.4.16.v20190411.jar => inst/java/jetty-http-9.4.16.v20190411.jar +0 -0
A inst/java/jetty-http-9.4.20.v20190813.jar => inst/java/jetty-http-9.4.20.v20190813.jar +0 -0
D inst/java/jetty-io-9.4.16.v20190411.jar => inst/java/jetty-io-9.4.16.v20190411.jar +0 -0
A inst/java/jetty-io-9.4.20.v20190813.jar => inst/java/jetty-io-9.4.20.v20190813.jar +0 -0
D inst/java/jetty-util-9.4.16.v20190411.jar => inst/java/jetty-util-9.4.16.v20190411.jar +0 -0
A inst/java/jetty-util-9.4.20.v20190813.jar => inst/java/jetty-util-9.4.20.v20190813.jar +0 -0
D inst/java/jetty-xml-9.4.16.v20190411.jar => inst/java/jetty-xml-9.4.16.v20190411.jar +0 -0
A inst/java/jetty-xml-9.4.20.v20190813.jar => inst/java/jetty-xml-9.4.20.v20190813.jar +0 -0
R inst/java/neko-htmlunit-2.35.0.jar => inst/java/neko-htmlunit-2.36.0.jar +0 -0
D inst/java/websocket-api-9.4.16.v20190411.jar => inst/java/websocket-api-9.4.16.v20190411.jar +0 -0
A inst/java/websocket-api-9.4.20.v20190813.jar => inst/java/websocket-api-9.4.20.v20190813.jar +0 -0
D inst/java/websocket-client-9.4.16.v20190411.jar => inst/java/websocket-client-9.4.16.v20190411.jar +0 -0
A inst/java/websocket-client-9.4.20.v20190813.jar => inst/java/websocket-client-9.4.20.v20190813.jar +0 -0
D inst/java/websocket-common-9.4.16.v20190411.jar => inst/java/websocket-common-9.4.16.v20190411.jar +0 -0
A inst/java/websocket-common-9.4.20.v20190813.jar => inst/java/websocket-common-9.4.20.v20190813.jar +0 -0
M java/htmlunit/Makefile => java/htmlunit/Makefile +4 -1
@@ 1,3 1,4 @@

.PHONY: clean pkg deps run

pkg:


@@ 8,8 9,10 @@ clean:
	mvn clean

deps:
	rm ../../inst/java/*.jar
	rm -f ../../inst/java/*.jar
	export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
	mvn dependency:copy-dependencies -DoutputDirectory=../../inst/java

new:
	export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
	mvn archetype:generate -DgroupId=is.rud.htmlunit -DartifactId=htmlunit -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

M java/htmlunit/pom.xml => java/htmlunit/pom.xml +1 -1
@@ 12,7 12,7 @@
    <dependency>
      <groupId>net.sourceforge.htmlunit</groupId>
      <artifactId>htmlunit</artifactId>
      <version>2.35.0</version>
      <version>2.36.0</version>
    </dependency>
  </dependencies>
</project>