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
//To scroll down web page by 900 pixels In x(vertical) direction. | |
//You can y parameter to scroll page In horizontal direction. | |
JavascriptExecutor javascript = (JavascriptExecutor) driver; javascript.executeScript("window.scrollBy(0,900)", ""); | |
//To scroll up web page by 300 pixels In x(vertical) direction. | |
javascript.executeScript("window.scrollBy(0,-300)", ""); |
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
String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t"); | |
driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab); |
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((AND(MOD(E14,2)<>0,MOD(E14,3)<>0)), "Pass", "Fail") |
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
=MID(A1,FIND("=",SUBSTITUTE(A1," ","=",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))+1,256) |
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
Actions action = new Actions(driver); | |
action.sendKeys(Keys.PAGE_DOWN); |
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
// Create instance of Javascript executor | |
JavascriptExecutor je = (JavascriptExecutor) driver; | |
//Identify the WebElement which will appear after scrolling down | |
WebElement element = driver.findElement(By.xpath("")); | |
// now execute query which actually will scroll until that element is not appeared on page. | |
je.executeScript("arguments[0].scrollIntoView(true);",element); //or | |
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); |
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
package com.demo.test; | |
import org.testng.annotations.DataProvider; | |
import org.testng.annotations.Factory; | |
import org.testng.annotations.Test; | |
public class FactoryAndDataProvider { | |
private String Source; | |
private String Desination; | |
@Factory(dataProvider = "SearchProvider") |
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
public class GetHoursBetweenDates { | |
public static void main(String[] args) { | |
int timeAMin = toMins("12:15"); | |
int timeBMin = toMins("22:30"); | |
System.out.println(timeBMin); | |
getJourneyDuration(timeAMin,timeBMin,1,3); | |
} | |
public static int toMins(String s) { |
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 java.text.ParseException; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.concurrent.TimeUnit; | |
public class DateDifferenceCheck { | |
public static void main(String[] args) { | |
SimpleDateFormat myFormat = new SimpleDateFormat("dd MM yyyy"); | |
String inputString1 = "24 05 2016"; |
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
public static void goToEndOfPage(WebDriver driver) | |
{ | |
Actions actions = new Actions(driver); | |
actions.keyDown(Keys.CONTROL).sendKeys(Keys.END).perform(); | |
} |
NewerOlder