Skip to content

Instantly share code, notes, and snippets.

from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
driver = Firefox()
driver.get('http://ya.ru')
element = driver.find_element(By.XPATH, 'id("mail")/a')
print element.get_attribute('href')
driver.close()
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
class Link(WebElement):
def get_href(self):
return self.get_attribute('href')
driver = Firefox()
driver.get('http://ya.ru')
@Khrol
Khrol / rand.py
Last active August 29, 2015 14:14
from random import randint
from math import copysign
def generate(exception, n):
x = randint(1, n - 1)
if x >= exception:
return x + 1
return x
def generate_math(exception, n):
@Khrol
Khrol / tmp.json
Last active August 29, 2015 14:22
tmp.json
{
"data":[
{
"id":"churn",
"values":[
{
"id":"2012-04-01",
"values":[
{
"id":"churn",
# -*- coding: utf-8 -*-
from webium import settings
from webium import driver as webium_driver_hack
from webium import BasePage
from selenium.webdriver.common.by import By
from webium import Find, Finds
from selenium.webdriver.remote.webelement import WebElement
from selenium import webdriver
import time
public class GenericUsage {
public <T extends BaseClass & SomeInterface> void useClass(T input) {
input.baseClassMethod();
input.someInterfaceMethod();
}
}
public class CastUsage2 {
public void useClass(SomeInterface input) {
((BaseClass)input).baseClassMethod();
input.someInterfaceMethod();
}
}
public class CastUsage {
public void useClass(BaseClass input) {
input.baseClassMethod();
((SomeInterface)input).someInterfaceMethod();
}
}
public interface SomeInterface {
public void someInterfaceMethod();
}