Skip to content

Instantly share code, notes, and snippets.

View sbabcoc's full-sized avatar
💭
All I Really Need to Know I Learned in Kindergarten

Scott Babcock sbabcoc

💭
All I Really Need to Know I Learned in Kindergarten
View GitHub Profile
package com.nordstrom.automation.selenium.support;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.HashSet;
@sbabcoc
sbabcoc / gist:c6227d1b2a63bbb1ceba6c35b4275f90
Created January 30, 2025 19:23
bazelisk build //java/...
**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.12.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\Users\scoba\source\repos> cd C:\github\selenium\
PS C:\github\selenium> bazelisk build //java/...
INFO: Analyzed 1801 targets (0 packages loaded, 0 targets configured).
ERROR: C:/github/selenium/java/src/org/openqa/selenium/grid/BUILD.bazel:221:8: Action java/src/org/openqa/selenium/grid/all-javadocs.jar failed: (Exit -1): javadoc.exe failed: error executing Action command (from target //java/src/org/openqa/selenium/grid:all-javadocs)
cd /d C:/users/scoba/_bazel_scoba/io65vnbs/execroot/_main
bazel-out\x64_windows-opt-exec-ST-d57f47055a04\bin\external\rules_jvm_external~\private\tools\java\com\github\bazelbuild\rules_jvm_external\javadoc\javadoc.exe --out bazel-out/x64_windows-fastbuild/bin/java/src/org/openqa/selenium/grid/all-javadocs.jar --element-list bazel-out/x64
@sbabcoc
sbabcoc / gist:8e57b93ebec1f019a98e82771d8b3868
Created January 28, 2025 18:18
bazel build //java/...
**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.12.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\Users\scoba\source\repos> cd C:\github\selenium\
PS C:\github\selenium> bazel build //java/...
INFO: Analyzed 1813 targets (3 packages loaded, 282 targets configured).
INFO: From Compiling absl/types/bad_optional_access.cc [for tool]:
cl : Command line warning D9002 : ignoring unknown option '-std=c++14'
INFO: From Compiling absl/time/internal/cctz/src/time_zone_fixed.cc [for tool]:
@sbabcoc
sbabcoc / gist:dcb0d3d049abb1780248ee38973add54
Last active January 24, 2025 00:33
operadriver --verbose
Starting OperaDriver 130.0.6723.137 (59d46b95c01984a5b09c060a98a17d81eafc2f11-refs/branch-heads/6723@{#2247}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping OperaDriver safe.
OperaDriver was started successfully on port 59032.
[1737678623.193][INFO]: [ffc6c0675707ab23431c425c2e33e556] COMMAND InitSession {
"capabilities": {
"firstMatch": [ {
"appium:automationName": "chromium",
"browserName": "chrome",
"goog:chromeOptions": {

Yes, you can replicate this kind of Intent verification in an integration test, where you validate that your application actually sends an intent to the system as part of its behavior when interacting with the UI. For integration testing with intents, Espresso-Intents is often the go-to library in Android. Here’s how you can use Espresso-Intents for integration testing of intent actions.

Integration Testing Intents with Espresso-Intents

Espresso-Intents lets you intercept and verify outgoing intents without actually launching the external application (like the browser). This approach is more robust in integration tests because it ensures your app is interacting correctly with the Android system.

Steps to Set Up and Use Espresso-Intents

  1. Add Espresso-Intents Dependency Ensure you have Espresso-Intents in your build.gradle file for your androidTest scope:

Certainly! When you use Mockito for testing intent actions, you're primarily concerned with verifying that your application correctly creates and sends the Intent for specific actions (like opening a URL in a browser). Here’s a breakdown of how to set up and use Mockito to test Intent actions in Android:

Step-by-Step Guide to Mocking Intents with Mockito

  1. Add Mockito Dependencies Ensure you have the necessary dependencies for Mockito in your build.gradle file:

    testImplementation 'org.mockito:mockito-core:4.x.x'
    testImplementation 'org.mockito:mockito-inline:4.x.x' // For mocking final classes/methods
private static final String UPDATE_VALUE =
"arguments[0].value=arguments[1]; arguments[0].dispatchEvent(new Event('input',{bubbles:true}));";
private static final String ELEMENT_MESSAGE = "[element] must be non-null";
/**
* Update the specified element with the indicated value
*
* @param element target element (checkbox)
* @param value desired value
* @return 'true' if element value changed; otherwise 'false'
@sbabcoc
sbabcoc / gist:a352393751df63a340840f89244cb5a5
Last active September 6, 2024 19:31
How to add arbitrary headers to HTTP requests

In Selenium 4, you can add arbitrary headers to HTTP requests using the DevTools protocol, which is now integrated into Selenium. Here's how you can do it with Chrome or Edge:

Example in Java (Selenium 4):

  1. Set up the ChromeDriver or EdgeDriver:
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.devtools.DevTools;
@sbabcoc
sbabcoc / XCUITest page components.md
Last active February 1, 2024 01:08
XCUITest page components
layout title category author tags summary-image
post
XCUITest Automation: Page Components for iOS Test Automation
mobile
Scott Babcock
xcuitest
mobile
swift
/articles/xcuitest/XCUITest.jpg

Creating Stable, Maintainable User Interface Test Automation in Swift

@sbabcoc
sbabcoc / XCUITest page object models.md
Last active January 31, 2024 20:48
XCUITest page object models
layout title category author tags summary-image
post
XCUITest Automation: Page Object Models for iOS Test Automation
mobile
Scott Babcock
xcuitest
mobile
swift
/articles/xcuitest/XCUITest.jpg

Creating Stable, Maintainable User Interface Test Automation in Swift