Skip to content

Instantly share code, notes, and snippets.

View ssmiech's full-sized avatar

Slawomir Smiechura ssmiech

View GitHub Profile
package selenium;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;;
d = Selenium::WebDriver.for :chrome
d.get "http://www.flipkart.com/"
select = Selenium::WebDriver::Support::Select.new(d.first(:id, "fk-search-select"))
#What's selected now
select.selected_options[0].text
#Change selection by index:
select.select_by(:index, 2)
select.selected_options[0].text
@ssmiech
ssmiech / Fonts.java
Created June 18, 2013 10:06
Element's font weight and color
package selenium;
import java.sql.Driver;
import java.util.List;
import java.util.concurrent.TimeUnit;
import selenium.Table;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
@ssmiech
ssmiech / gist:6725324
Created September 27, 2013 07:39
zookepeer
Building native extensions. This could take a while...
ERROR: Error installing zookeeper:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
Building zkc.
tar xzf zkc-3.3.5.tar.gz 2>&1 && patch -p0 < patch-zookeeper 2>&1
patching file c/src/zookeeper.c
./configure --prefix=/usr/local/lib/ruby/gems/1.9.1/gems/zookeeper-1.4.4/ext --with-pic --without-cppunit --disable-dependency-tracking 2>&1
checking for doxygen... no
package test;
public class Test {
public static final Empty EMPTY = new Empty();
public static void main(String[] args) {
// first test instantiates the Empty class
Empty first_test = EMPTY;
System.out.println(String.format("inFirst test before changing state: %b", first_test.isLoading()));
@ssmiech
ssmiech / table.html
Created February 6, 2014 15:43
Clicking <table> column based on another columnt
<table>
<tr>
<th>Name</th>
<th>Mobile</th>
<th>No Introducer</th>
<th>Created On</th>
<th>Status</th>
<th>Action</th>
</tr>
@ssmiech
ssmiech / invisibleText.java
Last active August 29, 2015 13:57
How to read text from hidden divs
package selenium;
import java.sql.Driver;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Wait;
require 'RMagick'
module WGif
class GifMaker
def make_gif(frames_dir, filename, dimensions)
image = Magick::ImageList.new(*frames_dir)
resize(image, dimensions)
image.coalesce
image.optimize_layers Magick::OptimizeLayer
image.write(filename)
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@ssmiech
ssmiech / GridInsetDecoration.java
Created April 8, 2016 14:32 — forked from UweTrottmann/GridInsetDecoration.java
RecyclerView grid spacing decoration for use with GridLayoutManager.
/*
* Copyright 2015 Uwe Trottmann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software