Skip to content

Instantly share code, notes, and snippets.

public static String sendhttpGetRequest(String url, String auth) throws Exception, IOException {
HttpGet request = new HttpGet(url);
if (auth != null) {
request.setHeader(HttpHeaders.AUTHORIZATION, auth);
}
request.setHeader("Content-Type", "application/json; charset=UTF-8");
@omerfiles
omerfiles / gist:14bde532eb643d22cd427ff6b2cf2dd0
Created February 4, 2018 09:09
click on multiple elements
public void clickOnMultipleElements(WebElement... elements) {
for (WebElement webElement : elements) {
try {
webElement.click();
} catch (Exception e) {
// TODO: handle exception
}
}
}
String response = netUtils.sendhttpGetRequest(url, null);
JSONObject jsonObject = new JSONObject(response);
String result = jsonObject.getJSONObject("value").get("ready").toString();
import org.junit.After;
import org.junit.Before;
public class BasicTest {
String testName;
String testId;
String userId;//In case a new user is created for every test
String orderId;//In case a new order is create for every test
@omerfiles
omerfiles / gist:3620236760bac66eca4cab9f0317104a
Created January 14, 2018 20:02
Basic Test - initial state
import org.junit.After;
import org.junit.Before;
public class BasicTest {
@Before
public void setup(){
}
@After
package drivers;
import java.net.URL;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
public class ChromeWebDriver extends GenericWebDriver {
@omerfiles
omerfiles / gist:4f71deae6b5d8b2adb8e
Created March 28, 2015 11:19
Generic Web driver
package drivers;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import Enums.ByTypes;
<profiles>
<profile>
<activation>
</activation>
<id>unitTests</id>
<build>
<plugins>
<plugin>