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
dr.get("http://walmart.com"); | |
JavascriptExecutor js = ((JavascriptExecutor)dr); | |
js.executeScript("window.scrollTo(0, document.body.scrollHeight)"); | |
String[] xpaths = {"//button[@class='f_a al_c f_c']", "//button[@data-tl-id='GlobalHeaderDepartmentsMenu-deptButtonFlyout-2']", "//a[@data-section-title='iPad & Tablets' and @data-uid='LHN-2-DEPT-7-CAT-1']"}; | |
List<String> xpathsList = Arrays.asList(xpaths); | |
for(int i = 0; i < xpathsList.size(); i++){ | |
clickOnSomeElement(dr, xpathsList.get(i)); |
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
WebDriver dr = new ChromeDriver(); | |
dr.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); | |
dr.manage().window().maximize(); | |
dr.get("https://www.seleniumeasy.com/test/basic-select-dropdown-demo.html?fbclid=IwAR2H2adwQzJ_HBhD3GVwQz5oJUom-EwyxAyAo9_xXRiX4QGbY04mIfjz0iM"); | |
Select barOne = new Select(dr.findElement(By.id("select-demo"))); | |
barOne.selectByIndex(3); | |
String selectedDay = barOne.getFirstSelectedOption().getText(); | |
System.out.println(selectedDay); |
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 void selectDepartureCity() { | |
Actions a = new Actions(dr); | |
a | |
.moveToElement(dr.findElement(By.xpath(String.format("//a[@value='%s']", pro.getProperty("depCityCode"))))) | |
.click() | |
.build() | |
.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
package activeProjects; | |
import java.util.Scanner; | |
public class Calculator { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
while (true) { | |
System.out.println("Basic calculator that does basic arithmetic functions"); |
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 spreadSheetTest.getAllContents; | |
import org.apache.poi.ss.usermodel.Cell; | |
import org.apache.poi.ss.usermodel.CellType; | |
import org.apache.poi.ss.usermodel.Row; | |
import org.apache.poi.ss.usermodel.Sheet; | |
import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
import java.io.FileInputStream; | |
import java.io.IOException; |
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.chrome.ChromeDriver; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import java.util.concurrent.TimeUnit; | |
public class SeleniumTest { | |
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
public void arrayMaxMinArray(){ | |
/* | |
* Constraints: | |
* | |
* Number of arrays provided must be between 1 and 100 | |
* Size of each array should be between 1 and 1000 | |
* Each individual array element should be between 1 and 10^12 | |
* */ |
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.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args){ | |
Main main = new Main(); | |
main.stringPalindromeCheck(1, 30, 1, 100); | |
} | |
public String[] takeUserString(int noOfTestCasesLower, int noOfTestCasesHigher, int noOfCharInStringLower, int noOfCharInStringHigher){ |
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.util.Scanner; | |
public class Mathematics { | |
public static void main(String[] args){ | |
Mathematics m1 = new Mathematics(); | |
m1.printThePatternSetOne(); | |
} | |
public void printThePatternSetOne(){ | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Enter value N, the number of columns to generate + the number to start each column with. "); |
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 void printTable() { | |
Scanner sc = new Scanner(System.in); | |
int t; | |
while (true) { | |
//this is the number of test cases | |
System.out.println("Enter the number of test cases (number of tables) to generate"); | |
t = sc.nextInt(); //this is the number of test cases | |
if (t >= 1 && t <= 100) { | |
break; | |
} else { |
OlderNewer