Skip to content

Instantly share code, notes, and snippets.

View diemol's full-sized avatar

Diego Molina diemol

View GitHub Profile
version: '2.1'
services:
app:
extends:
file: ../../docker-compose.yml
service: app
environment:
# Path is relative to the location of the dev server.
- WEBPACK_CONFIG=./acceptance/webpack.config.acceptance.js
@diemol
diemol / TestCaseForIssue465.java
Last active April 23, 2017 21:44
Simple test case to reproduce #465 and #87 in SeleniumHQ/docker-selenium
public class TestCaseForIssue465 {
// Setting the url for the WebDriver
private static final String URL = "http://localhost:4444/wd/hub";
@Test
public void checkPageTitle() throws MalformedURLException {
for (int i = 0; i < 100; i++) {
System.out.println("Execution # " + i);
DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
@diemol
diemol / HowTo.md
Last active January 31, 2018 09:38
How to use a Firefox custom profile with https://github.com/seleniumhq/docker-selenium

Steps to follow in the host machine (most likely, your machine).

Create a Firefox Profile

Copy the created profile to a given folder

  • In OSX, the profiles are located at ~/Library/Application Support/Firefox/Profiles. Find where they are in your operating system.
  • In the profiles folder you will find the profile you just created, for this case we will use the folder name hcqx24zh.selenium.
  • Copy the profile to a folder called firefox in a given location. E.g.:
version: '2'
services:
# Used for my local environment
selenium:
image: selenium/standalone-chrome:3.4.0
ports:
- "4444:4444" # WebDriver
- "5900:5900" # VNC
environment:
- TZ=Europe/Moscow
@diemol
diemol / Example.java
Created July 3, 2017 12:03
Code to improve
class Sample {
public String solution(String S) {
int len = S.length();
if (len >= 2 && len <= 100) {
char[] charList = new char[len];
charList = S.toCharArray();
int charDash = 0;
String sol = "";
int count = 0;
@diemol
diemol / start-docker-selenium.sh
Created July 8, 2017 14:46
Start Docker-Selenium
#!/bin/bash
#docker stop $(docker ps -a --quiet) && docker rm $(docker ps -a --quiet)
for i in {0..10}; do
echo item: $i
hostIp=10.161.128.80
echo hostIp: $hostIp
nodePort=$((40000 + i))
echo nodePort: $nodePort
noVncPort=$((50000 + i))
echo noVncPort: $noVncPort
@diemol
diemol / startHub
Last active October 9, 2017 23:11
Start a Selenium Grid
java -jar selenium-server-standalone-3.6.0.jar -role hub
@diemol
diemol / chromedriver-install.sh
Last active July 9, 2021 15:03
Geckodriver and Chromedriver installers for OSX/Mac
#!/bin/bash
# download and install latest chromedriver for linux or mac.
# required for selenium to drive a Chrome browser.
install_dir="/usr/local/bin"
version=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE)
if [[ $(uname) == "Darwin" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_mac64.zip
elif [[ $(uname) == "Linux" ]]; then
url=https://chromedriver.storage.googleapis.com/$version/chromedriver_linux64.zip
@diemol
diemol / docker-compose.yaml
Created October 10, 2017 12:30
A sample YAML file to spin up Selenium Grid via docker-compose
# docker-compose file
# To execute this docker-compose yml file use docker-compose -f <file_name> up
# Add the "-d" flag at the end for deattached execution
#selenium-hub: equivalent to manually running the command docker run -d -p 4444:4444 --name selenium-hub -P selenium/hub:3.6.0-bromine
selenium-hub:
restart: always
image: selenium/hub:3.6.0-bromine
ports:
- "4444:4444"
FirefoxProfile firefoxHeadlessProfile = new FirefoxProfile
{
DeleteAfterUse = true
};
firefoxHeadlessProfile.SetPreference("browser.cache.disk.enable", false);
firefoxHeadlessProfile.SetPreference("browser.cache.memory.enable", false);
firefoxHeadlessProfile.SetPreference("browser.cache.offline.enable", false);
firefoxHeadlessProfile.SetPreference("network.http.use-cache", false);
FirefoxOptions firefoxHeadlessOptions = new FirefoxOptions
{