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.By; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.openqa.selenium.support.ui.ExpectedCondition; | |
import org.openqa.selenium.support.ui.WebDriverWait; | |
import java.util.UUID; | |
public class SignupTest { | |
public static void main(String[] args) { |
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
GLOBALS.token = document.querySelector("#email_content").textContent.match(/Token: \w+/)[0].split(" ")[1]; | |
callback(true); // Signal that the Javascript step is done |
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
document.querySelector("#token").value = GLOBALS.token; | |
callback(true); // Signal that the Javascript step is done |
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 set_range(el, val): | |
driver.execute_javascript("arguments[0].value = arguments[1];", el, val); |
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 set_range(el, val): | |
minval = float(el.get_attribute("min") or 0) | |
maxval = float(el.get_attribute("max") or 100) | |
v = max(0, min(1, (float(val) - minval) / (maxval - minval))) | |
width = el.size["width"] | |
target = float(width) * v | |
ac = ActionChains(driver) | |
ac.move_to_element_with_offset(el, target, 1) | |
ac.click() | |
ac.perform() |
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 set_range(el, val): | |
# The adjustment helper to drag the slider thumb | |
def adjust(deltax): | |
if deltax < 0: | |
deltax = int(math.floor(min(-1, deltax))) | |
else: | |
deltax = int(math.ceil(max(1, deltax))) | |
ac = ActionChains(driver) | |
ac.click_and_hold(None) | |
ac.move_by_offset(deltax, 0) |
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
(function(jqueryUrl, callback) { | |
if (typeof jqueryUrl != 'string') { | |
jqueryUrl = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'; | |
} | |
if (typeof jQuery == 'undefined') { | |
var script = document.createElement('script'); | |
var head = document.getElementsByTagName('head')[0]; | |
var done = false; | |
script.onload = script.onreadystatechange = (function() { | |
if (!done && (!this.readyState || this.readyState == 'loaded' |
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
if (!GLOBALS.poll_time) { | |
var poll_timeout_seconds = 3; | |
} else { | |
var poll_timeout_seconds = GLOBALS.poll_time; | |
} | |
var element = "iframe.locator"; | |
var element_text = "Text to check"; | |
var poll_frequency_ms = 500; |
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
// For checking that a URL contains something, create a javascript step and write the following: | |
// You control what to find from the URL by changing the value of the "find" variable. | |
var find = "foo"; | |
if (window.location.href.indexOf(find) >= 0) { | |
return callback(true); | |
} else { | |
return callback("URL does not contain: " + find); | |
} |