This file contains hidden or 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
| public class ExpectedPage extends SlowLoadableComponent<ExpectedPage> { | |
| private WebDriver driver; | |
| private String pagelabel; | |
| private static int timeOutInSeconds = 3; // this controls how long get() method will | |
| // delay after load() and before isLoaded() | |
| public ExpectedPage(WebDriver drv) { | |
| super(new SystemClock(), timeOutInSeconds); | |
| System.out.println("Loading ExpectedPage Page"); | |
| this.driver = drv; |
This file contains hidden or 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
| var script = "some javascript"; | |
| var js = driver as IJavaScriptExecutor; | |
| var isDataCorrect = js.ExecuteScript(script); | |
| Assert.True(isDataCorrect); |
This file contains hidden or 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
| # When Mac OS X Mountain Lion was released, I did a completely clean install. Unfortunately [RVM](http://rvm.io) won't install directly on the stock release. Here are the steps to get the installation working. | |
| # This gist is based in part by [this post](http://theengguy.blogspot.ca/2012/04/setting-up-os-x-lion-and-mountain-lion.html) by [@theengguy](http://twitter.com/theengguy). | |
| # 1. Install [MacPorts](http://www.macports.org) | |
| # You can snag the package installer (easiest) from [https://distfiles.macports.org/MacPorts/MacPorts-2.1.2-10.8-MountainLion.pkg](https://distfiles.macports.org/MacPorts/MacPorts-2.1.2-10.8-MountainLion.pkg) | |
| # 2. Install a new version of curl | |
| sudo port -v selfupdate | |
| sudo port install curl |
This file contains hidden or 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
| # To install the Python client library: | |
| # pip install -U selenium | |
| # Import the Selenium 2 namespace (aka "webdriver") | |
| from selenium import webdriver | |
| # iPhone | |
| driver = webdriver.Remote(browser_name="iphone", command_executor='http://172.24.101.36:3001/hub') | |
| # Android |
This file contains hidden or 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 selenium import webdriver | |
| from selenium.webdriver.common.by import By | |
| class Page(object): | |
| """ | |
| Base class that all page models can inherit from | |
| """ | |
| def __init__(self, selenium_driver, base_url='https://test.axial.net', parent=None): | |
| self.base_url = base_url |
This file contains hidden or 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 java.util.List; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.function.Supplier; | |
| import java.util.function.UnaryOperator; | |
| class Person | |
| { | |
| String name; | |
| int age; |
This file contains hidden or 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.JavascriptExecutor; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.support.ui.ExpectedCondition; | |
| /** | |
| * Licensed under MIT License | |
| * Wraps a condition so that it returns only after the document state has settled for a given time, the default being 2 seconds. The | |
| * document is considered settled when the "document.readyState" field stays "complete" and the URL in the browser stops changing. | |
| */ | |
| public class DocumentSettleCondition<T> implements ExpectedCondition<T> { |
This file contains hidden or 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
| WebDriver webDriver = new FirefoxDriver(); | |
| webDriver.navigate().to("http://example.com/some/page"); | |
| // simplified: find table which contains the keyword | |
| WebElement tableElement = webDriver.findElement(By.xpath("//table[contains(text(), 'Username')]")); | |
| // create empty table object and iterate through all rows of the found table element | |
| ArrayList<HashMap<String, WebElement>> userTable = new ArrayList<HashMap<String, WebElement>>(); | |
| ArrayList<WebElement> rowElements = tableElement.findElements(By.xpath(".//tr")); |