Sample scripts to execute application configuration through Selenium a part of the provisioning (e.g. Octopusdeploy, tableau).
One can use template variables or even embedded subtemplates to isolate domain specific functionality:
There are two script options to utilize web page navigation payload
- control Selenium through a specific browser driver.
- control Selenium through RemoteDriver.
The latter will still end up in a specific driver, but will improve logging
To run interactively on the node
export GROOVY_HOME=/usr/local/groovy-2.4.5
export PATH=$PATH:$GROOVY_HOME/bin
export PATH=$PATH:/home/vncuser/selenium/firefox
export DISPLAY=:99
groovy basic.groovy
The value of DISPLAY would vary whether one runs in a vm with Xvfb (99) or vnc (1). When a RemoteDriver is used these settings are already in run_node.sh.
The groovy script can be deployed and run from a selenium vagrant box as part of automating some configuration. The following jar file layout is to be present on the machine locally (assuming groovy script is run by the root user):
/root/.groovy/grapes/
cglib
com.google.code.gson
com.google.guava
commons-codec
commons-io
commons-logging
net.java.dev.jna
org.apache
org.apache.commons
org.apache.httpcomponents
org.gebish
org.json
org.seleniumhq.selenium
org.sonatype.oss
with the following file layout for each jar directory:
/root/.groovy/grapes/commons-io/commons-io/ivy-2.4.xml
/root/.groovy/grapes/commons-io/commons-io/ivy-2.4.xml.original
/root/.groovy/grapes/commons-io/commons-io/jars/commons-io-2.4.jar
/root/.groovy/grapes/commons-io/commons-io/ivydata-2.4.properties
(total or 88 jars).
Instead of Selenium one may use Java client of Chrome DevTools Protocol.
This leads to significant reduction in the number of depenencies;
~/.groovy/grapes
~/.groovy/grapes/io.webfolder
~/.groovy/grapes/io.webfolder/cdp4j
~/.groovy/grapes/io.webfolder/cdp4j/ivy-2.2.2.xml
~/.groovy/grapes/io.webfolder/cdp4j/ivy-2.2.2.xml.original
~/.groovy/grapes/io.webfolder/cdp4j/ivydata-2.2.2.properties
~/.groovy/grapes/io.webfolder/cdp4j/jars
~/.groovy/grapes/io.webfolder/cdp4j/jars/cdp4j-2.2.2.jar