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 Rec87 { | |
| private PropertiesUtil factory; | |
| private List<String> listX; | |
| private List<String> listY; | |
| private String userIdX; | |
| private String locationNameX; | |
| private String userNameX; |
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")); |
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
| driver.get("http://the-internet.herokuapp.com"); | |
| driver.findElement(By.linkText("Dropdown")).click(); | |
| List<WebElement> dropdown=driver.findElements(By.xpath("//select[@id='dropdown']/option")); | |
| for (int i = 0; i < dropdown.size(); i++) { | |
| if(dropdown.get(i).getText()=="Please select an option") | |
| { | |
| //assert false will always expects false value. | |
| //Here option is disabled so it will return false | |
| Assert.assertFalse(dropdown.get(i).isEnabled()); | |
| } |
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
| package com.namely.selectors.id; | |
| import org.openqa.selenium.By; | |
| import java.util.function.Supplier; | |
| import static org.openqa.selenium.By.id; | |
| /** | |
| * Created by sayem on 12/30/15. |
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
| Boolean isJqueryUsed = (Boolean)((JavascriptExecutor)driver).executeScript("return (typeof(jQuery) != 'undefined')")); | |
| if(isJqueryUsed){ | |
| while (true){ | |
| // JavaScript test to verify jQuery is active or not | |
| Boolean ajaxIsComplete = (Boolean)(((JavascriptExecutor)driver).executeScript("return jQuery.active == 0")); | |
| if (ajaxIsComplete) break; | |
| try{ | |
| Thread.sleep(100); | |
| }catch (InterruptedException e) {} | |
| } |
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
| package com.sayem.browser; | |
| import java.net.URL; | |
| import java.util.Map; | |
| import org.openqa.selenium.WebDriverException; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.openqa.selenium.firefox.FirefoxDriver; | |
| import org.openqa.selenium.firefox.FirefoxProfile; |
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.apache.jmeter.control.LoopController; | |
| import org.apache.jmeter.engine.StandardJMeterEngine; | |
| import org.apache.jmeter.protocol.http.sampler.HTTPSampler; | |
| import org.apache.jmeter.testelement.TestElement; | |
| import org.apache.jmeter.testelement.TestPlan; | |
| import org.apache.jmeter.threads.SetupThreadGroup; | |
| import org.apache.jmeter.util.JMeterUtils; | |
| import org.apache.jorphan.collections.HashTree; | |
| public class JMeterTestFromCode { |
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
| apply plugin: 'maven' | |
| apply plugin: 'java' | |
| apply plugin: 'idea' | |
| sourceCompatibility = 1.8 | |
| targetCompatibility = 1.8 | |
| group = "com.booker" | |
| version = '1.0' | |
| repositories { |
NewerOlder