Skip to content

Instantly share code, notes, and snippets.

View sauceaaron's full-sized avatar
💭
Cooking ribs

Aaron Evans sauceaaron

💭
Cooking ribs
View GitHub Profile
package calculator.ios;
import com.testobject.TestObjectResultWatcher;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@sauceaaron
sauceaaron / RSelenium_Example.R
Last active November 14, 2019 00:40
Using R with RSelenium to get data
# install and load the RSelenium package
install.packages("RSelenium")
require(RSelenium)
# connect to your selenium server
driver <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "firefox")
# launch a browser and navigate to the page you want information from
driver$open()
driver$navigate("https://www.quora.com/How-do-you-use-R-via-Selenium-to-download-data-automatically/")
@sauceaaron
sauceaaron / AddElementToPage.java
Last active October 17, 2019 18:45
Show how to add elements into a page with Selenium using JavascriptExecutor and executeScript
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AddElementToPage
{
public static void main(String[] args)
{
String code =
"body = document.querySelector('body');" +
@sauceaaron
sauceaaron / MochaTestWithAnnotations.js
Last active November 23, 2022 08:22
Get test name and status in before / after hooks with mocha.js
var assert = require("assert");
describe("tests with annotations", function()
{
it("should print the test name in a before hook", function()
{
assert(true);
});
beforeEach("annotate before", function beforeEach()
import org.junit.Test;
public class JUnitThreadTest
{
public int count = 0;
@Test
public void test1() throws InterruptedException
{
count++;
import org.testng.annotations.Test;
public class TestNGThreadTest
{
public int count = 0;
@Test
public void test1() throws InterruptedException
{
count++;
import org.testng.Assert;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.MutableCapabilities;
import java.net.URL;
public class SeleniumNewVersionTest
{
public static void main(String[] args) throws Exception
@sauceaaron
sauceaaron / MenuSelectionTest.java
Last active September 26, 2019 17:32
Select the first or last item on a menu, or sort by price and select the most expensive. Or just order the lobster.
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.Comparator;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import static org.junit.Assert.assertEquals;
public class TestDataFromName
{
@Rule
public TestName testName = new TestName();
@sauceaaron
sauceaaron / MutableCapabilitiesTest.java
Last active September 19, 2019 20:51
Demonstrate how to use
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.MalformedURLException;