Skip to content

Instantly share code, notes, and snippets.

View timothyshort's full-sized avatar

Tim Short timothyshort

View GitHub Profile
@timothyshort
timothyshort / kill-browsers.bat
Created September 27, 2018 16:27
This Windows batch file kills all automated browser / drivers from leftover Selenium web automation
taskkill /IM geckodriver.exe /F
taskkill /IM IEDriverServer.exe /F
taskkill /IM chromedriver.exe /F
pipeline {
agent any
parameters {
string(name: 'server', defaultValue: "C:\\HexawareTraining\\Cohort1\\JenkinsLabs\\apache-tomcat-")
string(name: 'emailTo', defaultValue: "timothyjames.short@gmail.com")
}
triggers {
@timothyshort
timothyshort / server.js
Last active January 27, 2018 05:13
Sample NodeJS application that can be deployed to a web server with NodeJS installed
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("This is my Node JS app");
});
// Listen on port 8666, IP defaults to 127.0.0.1
server.listen(8666);
@timothyshort
timothyshort / VagrantfileNetwork.txt
Created January 27, 2018 04:03
Add this provisioning script to enable the network adapters for Vagrant / VirtualBox that will allow for SSH
config.vm.provider "virtualbox" do |vb|
### Change network card to PCnet-FAST III
# For NAT adapter
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
# For host-only adapter
vb.customize ["modifyvm", :id, "--nictype2", "Am79C973"]
end
@timothyshort
timothyshort / log4net.xml
Last active September 14, 2017 00:04
This is an XML configuration file for log4.net with App.config for C#.NET framework in Visual Studio
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net debug="false">
<appender name="LogFileAppender" type="log4net.Appender.FileAppender,log4net">
<!-- Modify this value to define the location and name of log file -->
<param name="File" value="C:\Desktopt\TestLog.log"/>
<param name="AppendtoFile" value="true"/>
@timothyshort
timothyshort / XML.java
Created July 26, 2017 12:40
This function takes an XML file and returns the data as a double array
// Dependencies: javax.xml | org.w3c.com | org.xml.sax
public static String[][] get(String file) {
String[][] data = null;
// 1. Prepare Xpath
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
try {
// 2. Create XML File
@timothyshort
timothyshort / GlobalConfigs.java
Created July 26, 2017 12:39
This function reads an XML document to define global settings
// Dependencies: javax.xml.xpath | org.w3c | org.xml
public static void setFramework(String file) {
// 1. Prepare Xpath
XPathFactory xpf = XPathFactory.newInstance();
XPath xPath = xpf.newXPath();
try {
// 2. Create XML File
InputSource inputSource = new InputSource(file);
@timothyshort
timothyshort / DriveryFactory.java
Last active September 9, 2020 22:27
This class generates a WebDriver
/*
* This class returns a WebDriver object using 3 overloaded .get() methods:
* 1. get() - default
* 2. get(String browserType)
* 3. get(String browserType, String webURL)
*/
public class DriverFactory {
string rootFolder = "C:\\Selenium\\Software\\";
@timothyshort
timothyshort / POM.xml
Created July 13, 2017 17:45
Maven's POM for Cucumber
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
@timothyshort
timothyshort / POM.xml
Last active July 13, 2017 16:11
Maven's POM.xml file for TestNG, JUnit, Selenium
<!-- ADD PROJECT DEPENDENCIES -->
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>