This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SeleniumTestCase(TestCase): | |
# Let us just call self.click or self.type instead of self.selenium.type | |
def __getattr__(self, name): | |
if hasattr(self, 'selenium'): | |
return getattr(self.selenium, name) | |
raise AttributeError(name) | |
# Ignore open commands that fail (same needs to be don for wait_for_page_to_load) | |
def open(self, url, ignoreResponseCode=True): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time, re | |
from selenium import selenium | |
class implicitWaitSelenium(selenium): | |
""" | |
Extending the regular selenium class to add implicit waits | |
""" | |
def __init__(self, *args): | |
self.implicit_wait = 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tearDown(self): | |
passed = {'passed': self._exc_info() == (None, None, None)} | |
self.selenium.set_context("sauce: job-info=%s" % json.dumps(passed)) | |
self.selenium.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.*; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import java.util.concurrent.TimeUnit; | |
public class Tweet { | |
public static void goTweet() throws Exception { | |
WebDriver driver = new FirefoxDriver(); | |
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); | |
driver.get("http://twitter.com"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Thread | |
from selenium import selenium | |
import time | |
try: | |
import json | |
except ImportError: | |
import simplejson as json | |
USERNAME = "USERNAME" | |
ACCESS_KEY = "ACCESS-KEY" |
NewerOlder