├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── README.md ├── drivers ├── IEDriverServer.exe ├── IEDriverServer_x64_3.150.1.zip ├── chromedriver.exe ├── chromedriver_win32.zip ├── chromedriver_win32 │ └── chromedriver.exe ├── chromedrivers.exe ├── ffmpeg.dll ├── geckodriver.exe ├── geckodriver_64 bit.exe └── icudtl.dat ├── pom.xml ├── src └── main │ └── java │ ├── feature │ ├── LensKart.feature │ ├── Naukri.feature │ └── Shien.feature │ ├── runner │ └── Runner.java │ ├── supportingClass │ ├── CompareMaps.java │ └── StudyAbroadHelper.java │ └── testCases │ ├── ACME.java │ ├── Amazon.java │ ├── AmazonJava8.java │ ├── CheckBoxJava8.java │ ├── CrmCloud.java │ ├── Day11SnapDeal.java │ ├── Day12carwala.java │ ├── Day13StudyAbroad.java │ ├── Day14AirBNB.java │ ├── Day14Zalando.java │ ├── Day16ajio.java │ ├── Day17Azure.java │ ├── Day1MyntraApp.java │ ├── Day2NykaaApp.java │ ├── Day3MakeMyTrip.java │ ├── Day4HP.java │ ├── Day5PostMan.java │ ├── Day6BigBasket.java │ ├── Day7Honda.java │ ├── Day8PepperFry.java │ ├── HondaTwoWheeler.java │ ├── Inbuild.java │ ├── JustDail.java │ ├── LensKart.java │ ├── Naukri.java │ ├── RedBus.java │ ├── Shein.java │ ├── ShienWC.java │ ├── StudyAbroad.java │ ├── Test.java │ ├── WindowsAuthentication.java │ └── ZoomCar.java └── test-output ├── Default suite ├── Default test.html ├── Default test.xml └── testng-failed.xml ├── bullet_point.png ├── collapseall.gif ├── emailable-report.html ├── failed.png ├── index.html ├── jquery-1.7.1.min.js ├── junitreports ├── TEST-runner.Runner.xml ├── TEST-testCases.LensKart.xml └── TEST-testCases.Shein.xml ├── navigator-bullet.png ├── old ├── Default suite │ ├── Default test.properties │ ├── classes.html │ ├── groups.html │ ├── index.html │ ├── main.html │ ├── methods-alphabetical.html │ ├── methods-not-run.html │ ├── methods.html │ ├── reporter-output.html │ ├── testng.xml.html │ └── toc.html └── index.html ├── passed.png ├── skipped.png ├── testng-failed.xml ├── testng-reports.css ├── testng-reports.js ├── testng-results.xml └── testng.css /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | VariousApplication 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 14 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 15 | org.eclipse.jdt.core.compiler.release=disabled 16 | org.eclipse.jdt.core.compiler.source=1.8 17 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SeleniumRealTimeAppTestCases 2 | 3 | Practicing various test cases in real world application provided by test Leaf 4 | -------------------------------------------------------------------------------- /drivers/IEDriverServer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/IEDriverServer.exe -------------------------------------------------------------------------------- /drivers/IEDriverServer_x64_3.150.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/IEDriverServer_x64_3.150.1.zip -------------------------------------------------------------------------------- /drivers/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/chromedriver.exe -------------------------------------------------------------------------------- /drivers/chromedriver_win32.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/chromedriver_win32.zip -------------------------------------------------------------------------------- /drivers/chromedriver_win32/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/chromedriver_win32/chromedriver.exe -------------------------------------------------------------------------------- /drivers/chromedrivers.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/chromedrivers.exe -------------------------------------------------------------------------------- /drivers/ffmpeg.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/ffmpeg.dll -------------------------------------------------------------------------------- /drivers/geckodriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/geckodriver.exe -------------------------------------------------------------------------------- /drivers/geckodriver_64 bit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/geckodriver_64 bit.exe -------------------------------------------------------------------------------- /drivers/icudtl.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/drivers/icudtl.dat -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | VariousApplication 6 | VariousApplication 7 | 0.0.1-SNAPSHOT 8 | 9 | 14 | 15 | org.seleniumhq.selenium 16 | selenium-java 17 | 3.141.59 18 | 19 | 20 | org.testng 21 | testng 22 | 7.0.0-beta1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/feature/LensKart.feature: -------------------------------------------------------------------------------- 1 | Feature: Lens kart End to End 2 | 3 | Scenario: Amount validation 4 | 5 | Given the user opens the browser and loads the given url 6 | And the user Mouseover on Contact Lenses 7 | And the user Click on Monthly under Explore By Disposability 8 | And the user Select brand as Aqualens 9 | And the user Click on the first product 10 | And the user Click Buy Now 11 | And the user Select No of boxes as 2 and Power as -1 for both eyes. 12 | And the user Type your name in User's name 13 | When the user And click Save and continue 14 | Then the user Print total amount and click Proceed to Checkout -------------------------------------------------------------------------------- /src/main/java/feature/Naukri.feature: -------------------------------------------------------------------------------- 1 | Feature: Naukri 2 | 3 | Scenario: TC001_Naukri 4 | 5 | Given the user load naukri url 6 | And the user goes the first opened window and get the company Name 7 | And the user closes that window 8 | And the user goes the second opened window and get the company Name 9 | And the user closes that window 10 | When the user uploads unsupported file as CV 11 | Then the user validates the error message -------------------------------------------------------------------------------- /src/main/java/feature/Shien.feature: -------------------------------------------------------------------------------- 1 | Feature: Shein 2 | 3 | Scenario: TC_001 4 | 5 | Given open https://www.shein.in/ 6 | And Mouseover on Clothing and click Jeans 7 | And Choose Black under Jeans product count 8 | And check size as medium 9 | And Click + in color 10 | And check whether the color is black 11 | And Click first item to Add to Bag 12 | And Click the size as M abd click Submit 13 | When Click view Bag 14 | Then Check the size is Medium or not. 15 | And Close the browser. -------------------------------------------------------------------------------- /src/main/java/runner/Runner.java: -------------------------------------------------------------------------------- 1 | package runner; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.WebDriver; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.chrome.ChromeOptions; 8 | import org.openqa.selenium.firefox.FirefoxDriver; 9 | import org.openqa.selenium.firefox.FirefoxOptions; 10 | import org.openqa.selenium.firefox.FirefoxProfile; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | import org.testng.annotations.BeforeMethod; 13 | import org.testng.annotations.BeforeSuite; 14 | 15 | import cucumber.api.CucumberOptions; 16 | import cucumber.api.testng.AbstractTestNGCucumberTests; 17 | 18 | @CucumberOptions(features = { "src\\main\\java\\feature\\Shien.feature" }, glue = { "testCases" }, dryRun = false,monochrome = true) 19 | public class Runner extends AbstractTestNGCucumberTests { 20 | 21 | public static RemoteWebDriver driver; 22 | String browserName = "chrome"; 23 | 24 | @BeforeSuite 25 | public void browserSetUp() { 26 | if (browserName.equals("chrome")) { 27 | ChromeOptions options = new ChromeOptions(); 28 | options.addArguments("--disable-notifications"); 29 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 30 | driver = new ChromeDriver(options); 31 | driver.manage().window().maximize(); 32 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 33 | } else if (browserName.equals("firefox")) { 34 | FirefoxOptions options = new FirefoxOptions(); 35 | options.setProfile(new FirefoxProfile()); 36 | options.addPreference("dom.webnotifications.enabled", false); 37 | System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver_64 bit.exe"); 38 | driver = new FirefoxDriver(); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/supportingClass/CompareMaps.java: -------------------------------------------------------------------------------- 1 | package supportingClass; 2 | 3 | import java.util.Iterator; 4 | import java.util.LinkedHashMap; 5 | import java.util.Map; 6 | import java.util.Map.Entry; 7 | import java.util.Set; 8 | import java.util.stream.Collectors; 9 | 10 | import com.google.common.collect.MapDifference; 11 | import com.google.common.collect.Maps; 12 | 13 | public class CompareMaps { 14 | 15 | public static void differences(Map first, Map second) { 16 | 17 | Map a1 = new LinkedHashMap(); 18 | 19 | for (Map.Entry a : first.entrySet()) { 20 | String key = a.getKey(); 21 | 22 | String value1 = a.getValue(); 23 | 24 | String value2 = second.get(key); 25 | // if(value1.equals(value2)) { 26 | // 27 | // }else { 28 | // a1.put(value1, value2); 29 | // } 30 | 31 | String c = value1.equals(value2) ? "" : a1.put(value1, value2); 32 | 33 | System.out.println(c); 34 | } 35 | 36 | System.out.println(a1); 37 | 38 | MapDifference difference = Maps.difference(first, second); 39 | System.out.println(difference); 40 | 41 | } 42 | 43 | public static void differences2(Map first, Map second) { 44 | Map a1 = new LinkedHashMap(); 45 | Iterator> iter1 = first.entrySet().iterator(); 46 | Iterator> iter2 = second.entrySet().iterator(); 47 | while (iter1.hasNext()) { 48 | Entry entry1 = iter1.next(); 49 | Entry entry2 = iter2.next(); 50 | if(!entry1.getValue().equals(entry2.getValue())) { 51 | a1.put(entry1.getValue(), entry2.getValue()); 52 | } 53 | } 54 | System.out.println(a1); 55 | } 56 | 57 | public static void main(String[] args) { 58 | Map dioEngineKeyValue = new LinkedHashMap(); 59 | Map activaEngineKeyValue = new LinkedHashMap(); 60 | 61 | dioEngineKeyValue.put("Type", "Fan Cooled, 4 Stroke, SI Engine"); 62 | dioEngineKeyValue.put("Displacement", "109.51cc"); 63 | dioEngineKeyValue.put("Max Net Power", "5.71 kW @ 8000 rpm"); 64 | 65 | activaEngineKeyValue.put("Type", "Fan Cooled, 4 Stroke, SI Engine"); 66 | activaEngineKeyValue.put("Displacement", "124 cc"); 67 | activaEngineKeyValue.put("Max Net Power", "6.10 kW @ 6500 rpm"); 68 | 69 | // System.out.println(dioEngineKeyValue.equals(activaEngineKeyValue)); 70 | 71 | differences2(dioEngineKeyValue, activaEngineKeyValue); 72 | 73 | // String a = "Sanjay"; 74 | // String b = "Sanjay"; 75 | // 76 | // String c = a.equals("Sanjay")?"equal":"notEqual"; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/supportingClass/StudyAbroadHelper.java: -------------------------------------------------------------------------------- 1 | package supportingClass; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.openqa.selenium.WebElement; 8 | 9 | public class StudyAbroadHelper { 10 | 11 | public static Map filter(List collegeNameList, List feesList) { 12 | Map enggWithFeesList = new HashMap<>(); 13 | for (int i = 0; i < collegeNameList.size(); i++) { 14 | if (collegeNameList.get(i).getText().contains("Engineering")) { 15 | enggWithFeesList.put(collegeNameList.get(i).getText(), feesList.get(i).getText()); 16 | } 17 | } 18 | return enggWithFeesList; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/testCases/ACME.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.time.Duration; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import org.openqa.selenium.By; 7 | import org.openqa.selenium.firefox.FirefoxDriver; 8 | import org.openqa.selenium.interactions.Actions; 9 | import org.openqa.selenium.remote.RemoteWebDriver; 10 | import org.openqa.selenium.support.ui.ExpectedConditions; 11 | import org.openqa.selenium.support.ui.WebDriverWait; 12 | 13 | public class ACME { 14 | 15 | public static void main(String[] args) { 16 | 17 | // 1) Launch URL: https://acme-test.uipath.com/account/login 18 | System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver_64 bit.exe"); 19 | RemoteWebDriver driver = new FirefoxDriver(); 20 | driver.get("https://acme-test.uipath.com/"); 21 | driver.manage().window().maximize(); 22 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 23 | 24 | // 2) Enter UserName (kumar.testleaf@gmail.com) and TAB 25 | driver.findElementById("email").sendKeys("kumar.testleaf@gmail.com"); 26 | 27 | // 3) Enter Password (leaf@12) 28 | driver.findElementById("password").sendKeys("leaf@12"); 29 | 30 | // 4) Click Login 31 | driver.findElementByXPath("//button[@type='submit']").click(); 32 | 33 | // 5) Mouse Over on Vendors 34 | Actions builder = new Actions(driver); 35 | builder.moveToElement(driver.findElementByXPath("(//button[@type='button']/i)[5]")).perform(); 36 | WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); 37 | 38 | 39 | 40 | // 6) Click Search Vendor 41 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Search for Vendor"))).click(); 42 | 43 | 44 | // 7) Enter Vendor Name (Blue Lagoon) 45 | driver.findElementById("vendorName").sendKeys("Blue Lagoon"); 46 | 47 | 48 | // 8) Click Search 49 | driver.findElementById("buttonSearch").click(); 50 | 51 | 52 | // 9) Find the Country Name based on the Vendor 53 | System.out.println(driver.findElementByXPath("(//th[text()='Country']/following::td)[5]").getText()); 54 | 55 | 56 | // 10) Click Log Out 57 | driver.findElementByXPath("//a[text()='Log Out']").click(); 58 | 59 | // 11) Close browser 60 | driver.quit(); 61 | 62 | 63 | 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/testCases/Amazon.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import org.openqa.selenium.By; 9 | import org.openqa.selenium.Keys; 10 | import org.openqa.selenium.WebElement; 11 | import org.openqa.selenium.ie.InternetExplorerDriver; 12 | import org.openqa.selenium.ie.InternetExplorerOptions; 13 | import org.openqa.selenium.interactions.Actions; 14 | import org.openqa.selenium.remote.DesiredCapabilities; 15 | import org.openqa.selenium.remote.RemoteWebDriver; 16 | import org.openqa.selenium.support.ui.ExpectedConditions; 17 | import org.openqa.selenium.support.ui.WebDriverWait; 18 | import org.testng.Assert; 19 | 20 | public class Amazon { 21 | 22 | public static void main(String[] args) throws InterruptedException { 23 | 24 | // 1. Launch URL: https://www.amazon.in/ 25 | // System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 26 | // RemoteWebDriver driver = new ChromeDriver(); 27 | 28 | System.setProperty("webdriver.ie.driver", "./drivers/IEDriverServer.exe"); 29 | // InternetExplorerOptions ieOptions = new InternetExplorerOptions(); 30 | // ieOptions.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true); 31 | // ieOptions.addCommandSwitches("-private"); 32 | RemoteWebDriver driver = new InternetExplorerDriver(); 33 | driver.get("https://www.amazon.in/"); 34 | driver.manage().window().maximize(); 35 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 36 | WebDriverWait wait = new WebDriverWait(driver, 15); 37 | 38 | // 2. Type "oneplus 7 pro mobiles" in Search Box and Enter 39 | driver.findElementById("twotabsearchtextbox").sendKeys("oneplus 7 pro mobiles", Keys.ENTER); 40 | 41 | // 3. Print the price of the first resulting mobile 42 | List priceList = driver.findElementsByXPath("//span[@class='a-price-whole']"); 43 | 44 | String firstElePrice = priceList.stream().map(ele -> ele.getText()).findFirst().get(); 45 | System.out.println(firstElePrice); 46 | 47 | // 4. Click on the Mobile (First resulting) image 48 | List imaList = driver.findElementsByXPath("//span[@class='rush-component']/a/div/img"); 49 | imaList.get(0).click(); 50 | 51 | // 5. Switch to the new window 52 | Set windowSet = driver.getWindowHandles(); 53 | List windowList = new ArrayList(windowSet); 54 | driver.switchTo().window(windowList.get(1)); 55 | System.out.println(driver.getTitle()); 56 | 57 | // 6. Print the number of customer ratings 58 | String cusRateCount = driver.findElementById("acrCustomerReviewText").getText(); 59 | System.out.println(cusRateCount); 60 | 61 | // 7. Click 'Add to Cart' 62 | driver.findElementByXPath("//a[contains(@class,'nav-a nav-a-2 a-pop')]").click(); 63 | driver.findElementByXPath("//div[@role='button']/preceding-sibling::div/input").sendKeys("603303"); 64 | Actions builder = new Actions(driver); 65 | builder.moveToElement(driver.findElementByXPath("//span[text()='Apply']")).click().perform(); 66 | wait.until(ExpectedConditions 67 | .refreshed(ExpectedConditions.stalenessOf(driver.findElementById("add-to-cart-button")))); 68 | driver.findElementById("add-to-cart-button").click(); 69 | 70 | // 8. Confirm "Added to Cart" text message appeared 71 | String verifyAddToCartMsg = new String(); 72 | 73 | Thread.sleep(5000); 74 | 75 | try { 76 | if (driver.findElements(By.xpath("//h1[@class='a-size-medium a-text-bold']")) != null) { 77 | verifyAddToCartMsg = driver.findElement(By.xpath("//h1[@class='a-size-medium a-text-bold']")).getText(); 78 | 79 | } else if (driver.findElementsByXPath("(//h4[@class='a-alert-heading'])[3]") != null) { 80 | verifyAddToCartMsg = driver.findElementByXPath("(//h4[@class='a-alert-heading'])[3]").getText(); 81 | 82 | } 83 | } catch (Exception e) { 84 | System.out.println("Element not found"); 85 | } 86 | 87 | System.out.println(verifyAddToCartMsg); 88 | Assert.assertEquals(verifyAddToCartMsg, "Added to Cart"); 89 | // 90 | // 9. Click to Proceed to Buy 91 | 92 | try { 93 | if (driver.findElementsById("hlb-ptc-btn-native") != null) { 94 | driver.findElementById("hlb-ptc-btn-native").click(); 95 | } else if (driver.findElementsByXPath("//input[@class='a-button-input']") != null) { 96 | driver.findElementByXPath("//input[@class='a-button-input']").click(); 97 | } 98 | } catch (Exception e) { 99 | // TODO: handle exception 100 | } 101 | 102 | // 10. Confirm the title is "Amazon Sign In" 103 | String title = driver.getTitle(); 104 | Assert.assertEquals(title, "Amazon Sign In"); 105 | 106 | // 11. Click Continue (without entering mobile number / email) 107 | driver.findElementById("continue").click(); 108 | 109 | // 12. Verify the error message: Enter your email or mobile phone number 110 | 111 | String errorMsg = new String(); 112 | 113 | try { 114 | if (driver.findElementsByXPath("//span[@class='a-list-item']") != null) { 115 | errorMsg = driver.findElementByXPath("//span[@class='a-list-item']").getText(); 116 | } else if (driver.findElementsByXPath("(//div[@class='a-alert-content'])[2]") != null) { 117 | errorMsg = driver.findElementByXPath("(//div[@class='a-alert-content'])[2]").getText(); 118 | } 119 | 120 | } catch (Exception e) { 121 | // TODO: handle exception 122 | } 123 | Assert.assertEquals(errorMsg, "Enter your email or mobile phone number"); 124 | 125 | // 13. Close both browsers 126 | 127 | driver.quit(); 128 | 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/testCases/AmazonJava8.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.List; 4 | import java.util.stream.Collector; 5 | import java.util.stream.Collectors; 6 | 7 | import org.openqa.selenium.WebElement; 8 | import org.openqa.selenium.chrome.ChromeDriver; 9 | import org.openqa.selenium.chrome.ChromeOptions; 10 | import org.openqa.selenium.remote.RemoteWebDriver; 11 | 12 | public class AmazonJava8 { 13 | 14 | public static void main(String[] args) { 15 | 16 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 17 | ChromeOptions options = new ChromeOptions(); 18 | // options.addArguments("--disable-notifications"); 19 | RemoteWebDriver driver = new ChromeDriver(); 20 | 21 | driver.get("https://www.amazon.in/"); 22 | 23 | List linkEle = driver.findElementsByTagName("a"); 24 | // 25 | // linkEle.forEach(ele -> System.out.println(ele.getText())); 26 | // 27 | // System.out.println("======================================="); 28 | // 29 | // List eleValue = linkEle.stream().filter(ele -> !ele.getText().equals("")).map(ele -> ele.getText()).collect(Collectors.toList()); 30 | // 31 | // eleValue.forEach(ele -> System.out.println(ele)); 32 | // 33 | // System.out.println("======================================="); 34 | // 35 | // String firstEle = linkEle.stream().filter(ele -> !ele.getText().equals("")).findFirst().get().getText(); 36 | // 37 | // System.out.println(firstEle); 38 | // 39 | // System.out.println("======================================="); 40 | // 41 | // String anyEle = linkEle.stream().filter(ele -> !ele.getText().equals("")).findAny().get().getText(); 42 | // 43 | // System.out.println(anyEle); 44 | // 45 | // System.out.println("======================================="); 46 | // 47 | // List collect = linkEle.stream().filter(ele -> !ele.getText().equals("") && ele.getText().contains("Amazon")).map(ele -> ele.getText()).collect(Collectors.toList()); 48 | // 49 | // collect.forEach(ele -> System.out.println(ele)); 50 | // 51 | // System.out.println("======================================="); 52 | 53 | List noBlankList = linkEle.stream().filter(ele -> !ele.getText().isEmpty()).filter(ele -> !ele.getText().startsWith(" ")) 54 | .map(ele -> ele.getText().trim()).collect(Collectors.toList()); 55 | 56 | noBlankList.forEach(ele->System.out.println(ele)); 57 | 58 | driver.quit(); 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/testCases/CheckBoxJava8.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.List; 4 | 5 | import org.openqa.selenium.WebElement; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.remote.RemoteWebDriver; 8 | 9 | public class CheckBoxJava8 { 10 | public static void main(String[] args) { 11 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 12 | RemoteWebDriver driver = new ChromeDriver(); 13 | 14 | driver.get("http://www.leafground.com/pages/checkbox.html"); 15 | 16 | List checkBoxes = driver.findElementsByXPath("//input[@type='checkbox']"); 17 | 18 | checkBoxes.forEach(ele -> ele.click()); 19 | 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/testCases/CrmCloud.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.time.Duration; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.openqa.selenium.By; 11 | import org.openqa.selenium.Keys; 12 | import org.openqa.selenium.chrome.ChromeDriver; 13 | import org.openqa.selenium.interactions.Actions; 14 | import org.openqa.selenium.remote.RemoteWebDriver; 15 | import org.openqa.selenium.support.ui.ExpectedCondition; 16 | import org.openqa.selenium.support.ui.ExpectedConditions; 17 | import org.openqa.selenium.support.ui.Select; 18 | import org.openqa.selenium.support.ui.WebDriverWait; 19 | import org.testng.Assert; 20 | 21 | public class CrmCloud { 22 | 23 | public static void main(String[] args) throws InterruptedException, ParseException { 24 | 25 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 26 | RemoteWebDriver driver = new ChromeDriver(); 27 | driver.manage().window().maximize(); 28 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 29 | 30 | // 1) Go to https://demo.1crmcloud.com/ 31 | driver.get("https://demo.1crmcloud.com/"); 32 | 33 | // 2) Give username as admin and password as admin 34 | driver.findElementById("login_user").sendKeys("admin"); 35 | driver.findElementById("login_pass").sendKeys("admin"); 36 | 37 | // 3) Choose theme as Claro Theme 38 | Select theme = new Select(driver.findElementById("login_theme")); 39 | theme.selectByVisibleText("Claro Theme"); 40 | driver.findElementByXPath("//span[text()='Login']").click(); 41 | 42 | // 4) Click on Sales and Marketting 43 | driver.findElementByXPath("//div[text()='Sales & Marketing']").click(); 44 | 45 | // 5) Click Create contact 46 | driver.findElementByXPath("//div[text()='Create Contact']").click(); 47 | 48 | // 6) Select Title and type First name, Last Name, Email and Phone Numbers 49 | // Thread.sleep(5000); 50 | // driver.findElement(By.xpath("Sales & Marketing")) 51 | WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); 52 | // driver.findElement(By.xpath("//li[@class='menubar-item current']//div")) 53 | wait.until(ExpectedConditions.textToBePresentInElementLocated( 54 | By.xpath("//li[@class='menubar-item current']//div"), "Sales & Marketing")); 55 | // wait.until(ExpectedConditions.textToBePresentInElement(driver.findElement(By.xpath("//li[@class='menubar-item current']//div")), "Sales & Marketing")); 56 | // wait.until(ExpectedConditions.textToBePresentInElementValue(driver.findElementByXPath("//div[text()='Sales & Marketing']/../.."), "menubar-item current")); 57 | 58 | Actions builder = new Actions(driver); 59 | builder.moveToElement(driver.findElementById("DetailFormsalutation-input-label")).click().perform(); 60 | 61 | driver.findElementByXPath("//div[text()='Mr.']").click(); 62 | driver.findElementById("DetailFormfirst_name-input").sendKeys("Sanjay"); 63 | driver.findElementById("DetailFormlast_name-input").sendKeys("M"); 64 | driver.findElementById("DetailFormemail1-input").sendKeys("msankrish92@gmail.com"); 65 | driver.findElementById("DetailFormphone_work-input").sendKeys("9940157064"); 66 | // 7) Select Lead Source as "Public Relations" 67 | driver.findElementById("DetailFormlead_source-input").click(); 68 | driver.findElementByXPath("//div[text()='Public Relations']").click(); 69 | 70 | // 8) Select Business Roles as "Sales" 71 | driver.findElementById("DetailFormbusiness_role-input").click(); 72 | driver.findElementByXPath("//div[text()='Sales']").click(); 73 | 74 | // 9) Fill the Primary Address, City, State, Country and Postal Code and click Save 75 | driver.findElementById("DetailFormprimary_address_street-input").sendKeys("Nookampalayam Road"); 76 | driver.findElementById("DetailFormalt_address_city-input").sendKeys("chennai"); 77 | driver.findElementById("DetailFormalt_address_state-input").sendKeys("TN"); 78 | driver.findElementById("DetailFormalt_address_country-input").sendKeys("India"); 79 | driver.findElementById("DetailFormalt_address_postalcode-input").sendKeys("600100"); 80 | driver.findElementById("DetailForm_save2").click(); 81 | Thread.sleep(5000); 82 | // 10) Mouse over on Today's Activities and click Meetings 83 | wait.until(ExpectedConditions.refreshed(ExpectedConditions.visibilityOfElementLocated(By.id("grouptab-0")))); 84 | builder.moveToElement(driver.findElementById("grouptab-0")).perform(); 85 | 86 | driver.findElementByXPath("//div[text()='Meetings']").click(); 87 | 88 | // 11) Click Create 89 | builder.moveToElement(driver.findElementByXPath("//span[text()='Create']")).click().perform(); 90 | 91 | // 12) Type Subject as "Project Status" , Status as "Planned" 92 | wait.until(ExpectedConditions 93 | .refreshed(ExpectedConditions.visibilityOfElementLocated(By.id("DetailFormname-input")))); 94 | driver.findElementById("DetailFormname-input").sendKeys("Project Status"); 95 | 96 | // 13) Start Date & Time as tomorrow 3 pm and Duration as 1hr 97 | // wait.until(ExpectedConditions.refreshed(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='DetailFormdate_start-input']/div/following-sibling::div")))); 98 | builder.moveToElement( 99 | driver.findElementByXPath("//div[@id='DetailFormdate_start-input']/div/following-sibling::div")).click() 100 | .perform(); 101 | for (int i = 0; i < 5; i++) { 102 | 103 | if (driver 104 | .findElementsByXPath("//div[contains(@class,'current selected responsive')]/following-sibling::div") 105 | .size() == 0) { 106 | builder.moveToElement( 107 | driver.findElementByXPath("//div[@id='DetailFormdate_start-input']/div/following-sibling::div")) 108 | .click().perform(); 109 | break; 110 | } 111 | } 112 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 113 | Calendar cal = Calendar.getInstance(); 114 | System.out.println("Current Date: " + sdf.format(cal.getTime())); 115 | cal.add(Calendar.DAY_OF_MONTH, 1); 116 | String newDate = sdf.format(cal.getTime()); 117 | System.out.println("Date after Addition: " + newDate); 118 | 119 | driver.findElementByXPath("(//input[@class='input-text'])[4]").sendKeys(newDate, Keys.ENTER); 120 | driver.findElementByXPath("//div[@id='DetailFormdate_start-calendar-text']//input").clear(); 121 | driver.findElementByXPath("//div[@id='DetailFormdate_start-calendar-text']//input").sendKeys("15"); 122 | driver.findElementByXPath("(//div[@id='DetailFormdate_start-calendar-text']//following-sibling::div)[5]") 123 | .click(); 124 | // 14) Click Add paricipants, add your created Contact name and click Save 125 | driver.findElementByName("addInvitee").click(); 126 | wait.until(ExpectedConditions.invisibilityOf(driver.findElementByXPath("(//input[@class='input-text'])[4]"))); 127 | wait.until(ExpectedConditions.refreshed( 128 | ExpectedConditions.visibilityOfElementLocated(By.xpath("(//input[@class='input-text'])[4]")))); 129 | driver.findElementByXPath("//div[@id='app-search-text']/input").sendKeys("Sanjay M"); 130 | driver.findElementByXPath("//div[text()='Sanjay M']").click(); 131 | driver.findElementById("DetailForm_save2-label").click(); 132 | // Thread.sleep(3000); 133 | wait.until(ExpectedConditions.titleContains("1CRM: Meetings")); 134 | 135 | // 15) Go to Sales and Marketting-->Contacts 136 | builder.moveToElement(driver.findElementByXPath("//div[text()='Sales & Marketing']")).perform(); 137 | driver.findElementByXPath("//div[text()='Contacts']").click(); 138 | 139 | // 16) search the lead Name and click the name from the result 140 | driver.findElementById("filter_text").sendKeys("Sanjay"); 141 | 142 | // Thread.sleep(5000); 143 | for (int i = 0; i < 5; i++) { 144 | driver.findElementById("filter_text").sendKeys(Keys.ENTER); 145 | if (driver.findElementsByXPath("//a[contains(text(),'Sanjay')]").size() != 0) { 146 | 147 | break; 148 | } 149 | } 150 | driver.findElementByXPath("//a[contains(text(),'Sanjay')]").click(); 151 | 152 | // 17) Check weather the Meeting is assigned to the contact under Activities Section. 153 | wait.until(ExpectedConditions.textToBe(By.xpath("//span[@class='detailLink']/a"),"Project Status")); 154 | // Thread.sleep(5000); 155 | String actual = driver.findElementByXPath("//span[@class='detailLink']/a").getText(); 156 | Assert.assertEquals(actual, "Project Status"); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day11SnapDeal.java: -------------------------------------------------------------------------------- 1 | 2 | package testCases; 3 | 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | import org.openqa.selenium.By; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.interactions.Actions; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | import org.openqa.selenium.support.ui.ExpectedCondition; 13 | import org.openqa.selenium.support.ui.ExpectedConditions; 14 | import org.openqa.selenium.support.ui.WebDriverWait; 15 | import org.testng.Assert; 16 | 17 | public class Day11SnapDeal { 18 | 19 | public static void main(String[] args) throws InterruptedException { 20 | 21 | // 1) Go to https://www.snapdeal.com/ 22 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 23 | RemoteWebDriver driver = new ChromeDriver(); 24 | driver.get("https://www.snapdeal.com/"); 25 | driver.manage().window().maximize(); 26 | // driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 27 | 28 | // ‎2) Mouse over on Toys, Kids' Fashion & more and click on Toys 29 | Actions builder = new Actions(driver); 30 | builder.moveToElement(driver.findElementByXPath("//span[contains(text(),\"Kids' Fashion & more\")]")).perform(); 31 | 32 | // 3) Click Educational Toys in Toys & Games 33 | WebDriverWait wait = new WebDriverWait(driver, 30); 34 | wait.until(ExpectedConditions 35 | .elementToBeClickable(driver.findElementByXPath("//span[contains(text(),\"Educational Toys\")]"))); 36 | 37 | driver.findElementByXPath("//span[contains(text(),\"Educational Toys\")]").click(); 38 | 39 | // ‎4) Click the Customer Rating 4 star and Up 40 | // Thread.sleep(3000); 41 | wait.until( 42 | ExpectedConditions.elementToBeClickable(driver.findElementByXPath("//label[@for=\"avgRating-4.0\"]"))); 43 | driver.findElementByXPath("//label[@for=\"avgRating-4.0\"]").click(); 44 | 45 | // 5) Click the offer as 40-50 46 | 47 | // Thread.sleep(3000); 48 | // wait.until(ExpectedConditions.visibilityOf(driver.findElementByXPath("//label[@for='discount-40 - 50']"))); 49 | Actions Builder = new Actions(driver); 50 | 51 | wait.until(ExpectedConditions.refreshed(ExpectedConditions 52 | .elementToBeClickable(By.xpath("//input[@id='discount-40%20-%2050']/following-sibling::label/a")))); 53 | // Thread.sleep(2000); 54 | builder.moveToElement( 55 | driver.findElementByXPath("//input[@id='discount-40%20-%2050']/following-sibling::label/a")).click() 56 | .build().perform(); 57 | 58 | if(driver.findElementById("discount-40%20-%2050").isSelected()) { 59 | System.out.println("selected"); 60 | }else { 61 | builder.moveToElement( 62 | driver.findElementByXPath("//input[@id='discount-40%20-%2050']/following-sibling::label/a")).click() 63 | .build().perform(); 64 | 65 | System.out.println("not selected"); 66 | } 67 | 68 | // try { 69 | // builder.moveToElement(driver.findElementByXPath("//label[@for='discount-40 - 50']/a")).click().build() 70 | // .perform(); 71 | // System.out.println("succ2"); 72 | // } catch (Exception e) { 73 | // System.out.println("Err2"); 74 | // } 75 | 76 | //// 6) Check the availability for the pincode 77 | driver.findElementByXPath("(//input[@class=\"sd-input\"])[2]").sendKeys("600100"); 78 | driver.findElementByXPath("//button[text()='Check']").click(); 79 | 80 | //// 7) Click the Quick View of the first product 81 | // Thread.sleep(5000); 82 | // wait.until(ExpectedConditions.refreshed(ExpectedConditions.elementToBeClickable(driver.findElementByXPath("//img[@class='product-image wooble']")))); 83 | wait.until(ExpectedConditions.refreshed( 84 | ExpectedConditions.visibilityOfElementLocated(By.xpath("//img[@class='product-image wooble']")))); 85 | builder.moveToElement(driver.findElementByXPath("//img[@class='product-image wooble']")).perform(); 86 | wait.until(ExpectedConditions.refreshed( 87 | ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[contains(text(),'Quick View')]")))); 88 | builder.moveToElement(driver.findElementByXPath("//div[contains(text(),'Quick View')]")).click().perform(); 89 | 90 | // 8) Click on View Details 91 | // Thread.sleep(5000); 92 | 93 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(text(),'view details')]"))); 94 | driver.findElementByXPath("//a[contains(text(),'view details')]").click(); 95 | 96 | Thread.sleep(2000); 97 | // driver.findElement(By.xpath("//a[contains(text(),'view details')]")) 98 | if (driver.findElements(By.xpath("//a[contains(text(),'view details')]")).size()!=0) { 99 | driver.findElementByXPath("//a[contains(text(),'view details')]").click(); 100 | System.out.println("element present"); 101 | }else { 102 | System.out.println("element not present"); 103 | } 104 | 105 | // 9) Capture the Price of the Product and Delivery Charge 106 | // String text = driver.findElementByXPath("//span[@itemprop='price']").getText(); 107 | // System.out.println(text); 108 | int firstProd = Integer 109 | .parseInt(driver.findElementByXPath("//span[@itemprop='price']").getText()); 110 | System.out.println(firstProd); 111 | 112 | // 10) Validate the You Pay amount matches the sum of (price+deliver charge) 113 | driver.findElementById("add-cart-button-id").click(); 114 | 115 | // 11) Search for Sanitizer 116 | wait.until(ExpectedConditions 117 | .refreshed(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("inputValEnter")))); 118 | driver.findElementById("inputValEnter").sendKeys("Sanitizer"); 119 | driver.findElementByXPath("(//a[@type='keyword'])[2]").click(); 120 | 121 | // 12) Click on Product "BioAyurveda Neem Power Hand Sanitizer" 122 | wait.until(ExpectedConditions.refreshed( 123 | ExpectedConditions.visibilityOfElementLocated(By.xpath("//img[contains(@class,'product-image')]")))); 124 | driver.findElementByXPath("//img[contains(@class,'product-image')]").click(); 125 | // 13) Capture the Price and Delivery Charge 126 | Set windows = driver.getWindowHandles(); 127 | List orderedWindow = new LinkedList(windows); 128 | driver.switchTo().window(orderedWindow.get(1)); 129 | int secProd = Integer.parseInt(driver.findElementByXPath("//span[@itemprop='price']").getText()); 130 | System.out.println(secProd); 131 | // 14) Click on Add to Cart 132 | driver.findElementById("add-cart-button-id").click(); 133 | 134 | // 15) Click on Cart 135 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Cart']"))); 136 | driver.findElementByXPath("//span[@class='cartTextSpan']").click(); 137 | int total = firstProd + secProd; 138 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='rfloat']"))); 139 | int cartTotal = Integer.parseInt(driver.findElementByXPath("//span[@class='rfloat']").getText().replaceAll("[^0-9]", "")); 140 | System.out.println(total); 141 | System.out.println(cartTotal); 142 | // 16) Validate the Proceed to Pay matches the total amount of both the products 143 | Assert.assertEquals(total, cartTotal); 144 | // 17) Close all the windows 145 | driver.findElementByXPath("//form[@id='checkout-continue']").click(); 146 | driver.quit(); 147 | 148 | } 149 | } -------------------------------------------------------------------------------- /src/main/java/testCases/Day12carwala.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/src/main/java/testCases/Day12carwala.java -------------------------------------------------------------------------------- /src/main/java/testCases/Day13StudyAbroad.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Map; 6 | import java.util.TreeMap; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import org.openqa.selenium.By; 10 | import org.openqa.selenium.JavascriptExecutor; 11 | import org.openqa.selenium.WebElement; 12 | import org.openqa.selenium.chrome.ChromeDriver; 13 | import org.openqa.selenium.chrome.ChromeOptions; 14 | import org.openqa.selenium.interactions.Actions; 15 | import org.openqa.selenium.remote.RemoteWebDriver; 16 | import org.openqa.selenium.support.ui.ExpectedConditions; 17 | import org.openqa.selenium.support.ui.Select; 18 | import org.openqa.selenium.support.ui.WebDriverWait; 19 | 20 | public class Day13StudyAbroad { 21 | public static void main(String[] args) throws InterruptedException { 22 | // 1) Go to https://studyabroad.shiksha.com/ 23 | ChromeOptions options = new ChromeOptions(); 24 | options.addArguments("--disable-notifications"); 25 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 26 | RemoteWebDriver driver = new ChromeDriver(); 27 | driver.get("https://studyabroad.shiksha.com/"); 28 | driver.manage().window().maximize(); 29 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 30 | WebDriverWait wait = new WebDriverWait(driver, 15); 31 | JavascriptExecutor js = (JavascriptExecutor) driver; 32 | 33 | // 2) Mouse over on Colleges and click MS in Computer Science &Engg under MS Colleges 34 | Actions builder = new Actions(driver); 35 | builder.moveToElement( 36 | driver.findElementByXPath("(//nav[@id='menu']//ul//label[contains(@class,\"fnt-wt melabel\")])[3]")) 37 | .perform(); 38 | driver.findElementByXPath("//a[text()='MS in Computer Science &Engg']").click(); 39 | 40 | // 3) Select GRE under Exam Accepted and Score 300 & Below 41 | driver.findElementByXPath("//p[text()='GRE']/preceding-sibling::span").click(); 42 | wait.until(ExpectedConditions 43 | .refreshed(ExpectedConditions.stalenessOf(driver.findElementByClassName("score-select-field")))); 44 | Select score = new Select(driver.findElementByClassName("score-select-field")); 45 | score.selectByValue("GRE--300--4"); 46 | 47 | // 4) Max 10 Lakhs under 1st year Total fees, USA under countries 48 | 49 | wait.until(ExpectedConditions.refreshed(ExpectedConditions 50 | .stalenessOf(driver.findElementByXPath("//input[@id='fee-0']/following-sibling::label/span")))); 51 | driver.findElementByXPath("//input[@id='fee-0']/following-sibling::label/span").click(); 52 | 53 | // 5) Select Sort By: Low to high 1st year total fees 54 | wait.until( 55 | ExpectedConditions.refreshed(ExpectedConditions.stalenessOf(driver.findElementById("categorySorter")))); 56 | Select sortBy = new Select(driver.findElementById("categorySorter")); 57 | sortBy.selectByValue("fees_ASC"); 58 | 59 | // 6) Click Add to compare of the College having least fees with Public University, Scholarship and Accomadation 60 | wait.until(ExpectedConditions.refreshed(ExpectedConditions 61 | .stalenessOf(driver.findElementByXPath("(//div[contains(@class,'uni-course-details flLt')])")))); 62 | 63 | List noOfColl = driver.findElementsByXPath("(//div[contains(@class,'uni-course-details flLt')])"); 64 | 65 | List findElements = new ArrayList(); 66 | for (int i = 1; i <= noOfColl.size(); i++) { 67 | 68 | String publicUniversity = driver 69 | .findElementByXPath( 70 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[1]") 71 | .getAttribute("class"); 72 | String Scholarship = driver 73 | .findElementByXPath( 74 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[2]") 75 | .getAttribute("class"); 76 | 77 | String Accommodation = driver 78 | .findElementByXPath( 79 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[3]") 80 | .getAttribute("class"); 81 | 82 | if (driver 83 | .findElementByXPath( 84 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[1]") 85 | .getAttribute("class").equals("tick-mark") 86 | && driver 87 | .findElementByXPath( 88 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[2]") 89 | .getAttribute("class").equals("tick-mark") 90 | && driver 91 | .findElementByXPath( 92 | "((//div[contains(@class,'uni-course-details flLt')])[" + i + "]//div[3]//span)[3]") 93 | .getAttribute("class").equals("tick-mark")) { 94 | findElements.add(driver.findElement( 95 | By.xpath("(//strong[text()=' 1st Year Total Fees'])[" + i + "]//following-sibling::p"))); 96 | 97 | } 98 | } 99 | 100 | TreeMap rate = new TreeMap(); 101 | 102 | for (int i = 0; i < findElements.size(); i++) { 103 | rate.put(findElements.get(i).getText(), findElements.get(i).getText().replaceAll("[^0-9.]", "")); 104 | } 105 | 106 | driver.findElementByXPath( 107 | "//p[text()=\"" + rate.firstKey() + "\"]/parent::div/parent::div/parent::div/following-sibling::div[2]") 108 | .click(); 109 | 110 | // 7) Select the first college under Compare with similar colleges 111 | driver.findElementByXPath("(//a[text()='OK'])[2]").click(); 112 | wait.until(ExpectedConditions 113 | .elementToBeClickable(driver.findElementByXPath("//ul[@class='sticky-suggestion-list']/li/a"))); 114 | driver.findElementByXPath("//ul[@class='sticky-suggestion-list']/li/a").click(); 115 | // 8) Click on Compare College> 116 | driver.findElementByXPath("//strong[text()='Compare Colleges >']").click(); 117 | // 9) Select When to Study as 2021 118 | driver.findElementByXPath("(//span[@class='common-sprite'])[2]").click(); 119 | // 10) Select Preferred Countries as USA 120 | driver.findElementByXPath("//div[@class='input']").click(); 121 | driver.findElementByXPath("//input[contains(@id,'USA')]/following-sibling::label/span").click(); 122 | driver.findElementByXPath("//a[@class='ok-btn']").click(); 123 | // 11) Select Level of Study as Masters 124 | driver.findElementByXPath("//label[contains(@for,\"Masters\")]/span").click(); 125 | 126 | // 12) Select Preferred Course as MS 127 | driver.findElementByXPath("(//div[@class='input'])[2]").click(); 128 | driver.findElementByXPath("//li[text()='MS']").click(); 129 | 130 | // 13) Select Specialization as "Computer Science & Engineering" 131 | driver.findElementByXPath("(//div[@class='input'])[3]").click(); 132 | driver.findElementByXPath("//li[text()='Computer Science & Engineering']").click(); 133 | // 14) Click on Sign Up 134 | driver.findElementById("signup").click(); 135 | // 15) Print all the warning messages displayed on the screen for missed 136 | List WarningMessages = driver.findElementsByXPath("//div[contains(text(),\"Please\")]"); 137 | for (int i = 0; i < WarningMessages.size(); i++) { 138 | System.out.println(WarningMessages.get(i).getText()); 139 | 140 | } 141 | driver.quit(); 142 | } 143 | } 144 | 145 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day14AirBNB.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | 5 | import java.util.List; 6 | 7 | import java.util.Set; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import org.openqa.selenium.By; 11 | import org.openqa.selenium.JavascriptExecutor; 12 | import org.openqa.selenium.Keys; 13 | import org.openqa.selenium.WebElement; 14 | import org.openqa.selenium.chrome.ChromeDriver; 15 | import org.openqa.selenium.interactions.Actions; 16 | import org.openqa.selenium.remote.RemoteWebDriver; 17 | import org.openqa.selenium.support.ui.ExpectedConditions; 18 | import org.openqa.selenium.support.ui.WebDriverWait; 19 | import org.testng.Assert; 20 | 21 | public class Day14AirBNB { 22 | public static void main(String[] args) throws InterruptedException { 23 | // 1) Go to https://www.airbnb.co.in/ 24 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 25 | RemoteWebDriver driver = new ChromeDriver(); 26 | driver.manage().window().maximize(); 27 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 28 | driver.get("https://www.airbnb.co.in/"); 29 | WebDriverWait wait = new WebDriverWait(driver, 20); 30 | JavascriptExecutor js = (JavascriptExecutor) driver; 31 | Actions builder = new Actions(driver); 32 | // 2) Type Coorg in location and Select Coorg, Karnataka 33 | 34 | wait.until(ExpectedConditions.visibilityOf(driver.findElementByXPath("//button[text()='OK']"))); 35 | wait.until(ExpectedConditions.elementToBeClickable(driver.findElementByXPath("//button[text()='OK']"))); 36 | try { 37 | for (int i = 0; i < 2; i++) { 38 | driver.findElementByXPath("//button[text()='OK']").click(); 39 | } 40 | 41 | } catch (Exception e) { 42 | 43 | } 44 | 45 | driver.findElementByXPath("//div[text()='Location']").click(); 46 | 47 | driver.findElementByXPath("//input[@id='bigsearch-query-attached-query']").sendKeys("Coorg"); 48 | driver.findElementByXPath("//div[text()='Coorg, Karnataka']").click(); 49 | 50 | // 3) Select the Start Date as June 1st and End Date as June 5th 51 | driver.findElementByXPath("(//div[text()='1'])[3]").click(); 52 | driver.findElementByXPath("(//div[text()='5'])[3]").click(); 53 | 54 | // 4) Select guests as 6 adults, 3 child and Click Search 55 | driver.findElementByXPath("//div[text()='Guests']").click(); 56 | for (int i = 0; i < 6; i++) { 57 | driver.findElementByXPath("(//button[@type='button']//*[name()='svg' and @focusable='false'])[2]").click(); 58 | } 59 | 60 | for (int i = 0; i < 3; i++) { 61 | driver.findElementByXPath("(//button[@type='button']//*[name()='svg' and @focusable='false'])[4]").click(); 62 | } 63 | driver.findElementByXPath("//button[@type='submit']").click(); 64 | 65 | // 5) Click Cancellation flexibility and enable the filter and Save 66 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='FMP-target']"))); 67 | driver.findElementByXPath("//span[text()='Cancellation flexibility']").click(); 68 | driver.findElementByXPath("//button[@id='filterItem-switch-flexible_cancellation-true']").click(); 69 | 70 | driver.findElementByXPath("//button[@id='filter-panel-save-button']").click(); 71 | 72 | // 6) Select Type of Place as Entire Place and Save 73 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='FMP-target']"))); 74 | driver.findElementByXPath("//span[text()='Type of place']").click(); 75 | driver.findElementByXPath("//input[@name='Entire place']//following-sibling::span").click(); 76 | driver.findElementByXPath("//button[@id='filter-panel-save-button']").click(); 77 | 78 | // 7) Set Min price as 3000 and max price as 5000 79 | Thread.sleep(5000); 80 | 81 | driver.findElementByXPath("//span[text()='Price']").click(); 82 | driver.findElementByXPath("//input[@id='price_filter_min']").click(); 83 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='FMP-target']"))); 84 | 85 | for (int i = 0; i < 5; i++) { 86 | driver.findElementByXPath("//input[@id='price_filter_min']").sendKeys(Keys.BACK_SPACE); 87 | 88 | } 89 | driver.findElementByXPath("//input[@id='price_filter_min']").sendKeys("3000"); 90 | for (int i = 0; i < 10; i++) { 91 | driver.findElementByXPath("//input[@id='price_filter_max']").sendKeys(Keys.BACK_SPACE); 92 | 93 | } 94 | driver.findElementByXPath("//input[@id='price_filter_max']").sendKeys("5000"); 95 | driver.findElementByXPath("//button[@id='filter-panel-save-button']").click(); 96 | // 8) Click More Filters and set 3 Bedrooms and 3 Bathrooms 97 | 98 | driver.findElementByXPath("//span[text()='More filters']").click(); 99 | Thread.sleep(5000); 100 | for (int i = 0; i < 3; i++) { 101 | 102 | driver.findElementByXPath( 103 | "(//div[@id='filterItem-stepper-min_bedrooms-0']//button[@type='button']//*[name()='svg' and @role='presentation'])[2]") 104 | .click(); 105 | } 106 | for (int i = 0; i < 3; i++) { 107 | driver.findElementByXPath( 108 | "(//div[@id='filterItem-stepper-min_bathrooms-0']//button[@type='button']//*[name()='svg' and @role='presentation'])[2]") 109 | .click(); 110 | } 111 | 112 | // 9) Check the Amenities with Kitchen, Facilities with Free parking on 113 | // premisses, Property as House and Host Language as English and click on Stays 114 | // only when stays available 115 | 116 | driver.findElementByXPath("//input[@id='filterItem-checkbox-amenities-8']/following-sibling::span").click(); 117 | driver.findElementByXPath("//input[@id='filterItem-checkbox-amenities-9']/following-sibling::span").click(); 118 | 119 | driver.findElementByXPath("//input[@id='filterItem-checkbox-languages-1']/following-sibling::span").click(); 120 | 121 | Thread.sleep(2000); 122 | driver.findElementByXPath("//button[contains(text(),\"Show\")]").click(); 123 | 124 | // 10) Click Prahari Nivas, the complete house 125 | Thread.sleep(2000); 126 | driver.findElementByXPath("//div[@itemprop='itemListElement']").click(); 127 | Set windowHandles = driver.getWindowHandles(); 128 | List listWindow = new ArrayList(windowHandles); 129 | driver.switchTo().window(listWindow.get(1)); 130 | 131 | // 11) Click on "Show all * amenities" 132 | Thread.sleep(5000); 133 | try { 134 | driver.findElementByXPath("//a[contains(text(),'Show all')]").click(); 135 | 136 | } catch (Exception e) { 137 | // TODO: handle exception 138 | } 139 | try { 140 | driver.findElementByXPath("//button[contains(text(),'Show all')]").click(); 141 | } catch (Exception e) { 142 | // TODO: handle exception 143 | } 144 | 145 | // 12) Print all the Not included amenities 146 | Thread.sleep(5000); 147 | try { 148 | builder.moveToElement(driver.findElementByXPath("//div[text()='Not included']")).perform(); 149 | } catch (Exception e) { 150 | // TODO: handle exception 151 | } 152 | try { 153 | builder.moveToElement(driver.findElementByXPath("//h4[text()='Not included']")).perform(); 154 | } catch (Exception e) { 155 | // TODO: handle exception 156 | } 157 | 158 | js.executeScript("window.scrollTo(0, document.body.scrollHeight)"); 159 | List notIncludedamenities = driver.findElementsByXPath("//span[contains(text(),\"Unavailable\")]"); 160 | for (int i = 0; i < notIncludedamenities.size(); i++) { 161 | System.out.println(notIncludedamenities.get(i).getText()); 162 | } 163 | driver.findElementByXPath("//div[@aria-label='Amenities']//div//button").click(); 164 | 165 | // 13) Verify the Check-in date, Check-out date and Guests 166 | String checkIn; 167 | String checkOut; 168 | try { 169 | checkIn = driver.findElementById("checkin").getAttribute("value"); 170 | Assert.assertEquals(checkIn, "2020-06-01"); 171 | checkOut = driver.findElementById("checkout").getAttribute("value"); 172 | Assert.assertEquals(checkOut, "2020-06-05"); 173 | System.out.println("Check in and checkout date verified"); 174 | 175 | } catch (Exception e) { 176 | // TODO: handle exception 177 | } 178 | try { 179 | checkIn = driver.findElementByXPath("(//div[text()='Check-in']/following-sibling::div)[1]").getText(); 180 | checkOut = driver.findElementByXPath("(//div[text()='Checkout']/following-sibling::div)[1]").getText(); 181 | Assert.assertEquals(checkIn, "06/01/2020"); 182 | Assert.assertEquals(checkOut, "06/05/2020"); 183 | System.out.println("Check in and checkout date verified"); 184 | } catch (Exception e) { 185 | // TODO: handle exception 186 | } 187 | 188 | // 14) Read all the Sleeping arrangements and Print 189 | List bedRooms = driver.findElementsByXPath("//div[contains(text(),'Bedroom')]"); 190 | List bedType = driver 191 | .findElementsByXPath("//div[contains(text(),'Bedroom')]/following-sibling::div"); 192 | 193 | for (int i = 0; i < 3; i++) { 194 | System.out.println(bedRooms.get(i).getText() + " --> " + bedType.get(i).getText()); 195 | } 196 | 197 | for (int i = 0; i < bedRooms.size() - 3; i++) { 198 | Thread.sleep(2000); 199 | driver.findElementByXPath("//button[@type='button']//*[name()='svg' and @aria-label='Next']").click(); 200 | 201 | bedRooms.set(3 + i, driver.findElementByXPath("(//div[contains(text(),'Bedroom')])[" + (4 + i) + "]")); 202 | Thread.sleep(5000); 203 | } 204 | 205 | for (int i = 3; i < bedRooms.size(); i++) { 206 | System.out.println(bedRooms.get(i).getText() + " --> " + bedType.get(i).getText()); 207 | } 208 | driver.quit(); 209 | } 210 | } 211 | 212 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day14Zalando.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.JavascriptExecutor; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.chrome.ChromeOptions; 11 | import org.openqa.selenium.interactions.Actions; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | import org.openqa.selenium.support.ui.ExpectedConditions; 14 | import org.openqa.selenium.support.ui.WebDriverWait; 15 | 16 | public class Day14Zalando { 17 | public static void main(String[] args) throws InterruptedException { 18 | 19 | // 1) Go to https://www.zalando.com/ 20 | ChromeOptions ops = new ChromeOptions(); 21 | ops.addArguments("--disable-notifications"); 22 | 23 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 24 | RemoteWebDriver driver = new ChromeDriver(ops); 25 | driver.manage().window().maximize(); 26 | driver.get("https://www.zalando.com/"); 27 | Actions builder = new Actions(driver); 28 | WebDriverWait wait = new WebDriverWait(driver, 20); 29 | JavascriptExecutor js = (JavascriptExecutor) driver; 30 | 31 | // 2) Get the Alert text and print it 32 | wait.until(ExpectedConditions.alertIsPresent()); 33 | String alertText = driver.switchTo().alert().getText(); 34 | System.out.println(alertText); 35 | // 3) Close the Alert box and click on Zalando.uk 36 | driver.switchTo().alert().dismiss(); 37 | driver.findElementByXPath("//a[text()='Zalando.uk']").click(); 38 | // 4) Click Women--> Clothing and click Coat 39 | driver.findElementByXPath("//span[text()='Women']").click(); 40 | builder.moveToElement(driver.findElementByXPath("//span[text()='Clothing']")).click().perform(); 41 | wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("(//a[text()='Coats'])[3]"))); 42 | driver.findElementByXPath("(//a[text()='Coats'])[3]").click(); 43 | // 5) Choose Material as cotton (100%) and Length as thigh-length 44 | 45 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@id='uc-optin-timer-display']/.."))); 46 | driver.findElementByXPath("//span[@id='uc-optin-timer-display']/..").click(); 47 | wait.until(ExpectedConditions.refreshed(ExpectedConditions.visibilityOfAllElementsLocatedBy( 48 | By.xpath("(//*[name()='svg' and @class='z-icon_svg']//*[local-name()='use'])[10]")))); 49 | builder.moveToElement( 50 | driver.findElementByXPath("(//*[name()='svg' and @class='z-icon_svg']//*[local-name()='use'])[10]")) 51 | .click().build().perform(); 52 | 53 | driver.findElementByXPath("//span[text()='cotton (100%)']").click(); 54 | driver.findElementByXPath("//button[text()='Save']").click(); 55 | 56 | for (int i = 0; i < 5; i++) { 57 | 58 | if (driver 59 | .findElementsByXPath( 60 | "//div[@class='cat_box-61TrD cat_brd-4-27afw cat_narrow-GAhUW cat_right-1U6ZW']") 61 | .size() != 0) { 62 | break; 63 | } 64 | try { 65 | builder.moveToElement(driver 66 | .findElementByXPath("(//*[name()='svg' and @class='z-icon_svg']//*[local-name()='use'])[13]")) 67 | .click().build().perform(); 68 | 69 | } catch (Exception e) { 70 | 71 | } 72 | } 73 | 74 | driver.findElementByXPath("//span[text()='thigh-length']").click(); 75 | driver.findElementByXPath("//button[text()='Save']").click(); 76 | 77 | // 6) Click on Q/S designed by MANTEL - Parka coat 78 | wait.until(ExpectedConditions.refreshed( 79 | ExpectedConditions.stalenessOf(driver.findElementByXPath("//div[text()='Q/S designed by']")))); 80 | wait.until(ExpectedConditions.stalenessOf(driver.findElementByXPath("//div[text()='Q/S designed by']"))); 81 | driver.findElementByXPath("//div[text()='Q/S designed by']").click(); 82 | 83 | // 7) Check the availability for Color as Olive and Size as 'M'. 84 | wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("(//img[@alt='olive'])[2]"))); 85 | driver.findElementByXPath("(//img[@alt='olive'])[2]").click(); 86 | wait.until( 87 | ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//button[@id='picker-trigger']/span"))); 88 | driver.findElementByXPath("//button[@id='picker-trigger']/span").click(); 89 | driver.findElementByXPath("//span[text()='M']").click(); 90 | 91 | // 8) If the previous preference is not available, check availability for Color Navy and Size 'M' 92 | if (driver.findElementByXPath("//div[@class='Wqd6Qu']/h2").getText().equals("Out of stock")) { 93 | driver.findElementByXPath("(//img[@alt='navy'])[2]").click(); 94 | wait.until(ExpectedConditions 95 | .visibilityOfAllElementsLocatedBy(By.xpath("//button[@id='picker-trigger']/span"))); 96 | driver.findElementByXPath("//button[@id='picker-trigger']/span").click(); 97 | driver.findElementByXPath("//span[text()='M']").click(); 98 | } 99 | 100 | // 9) Add to bag only if Standard Delivery is free 101 | if (driver.findElementByXPath("(//span[@class='AtOZbZ'])[2]").getText().equals("Free")) { 102 | driver.findElementByXPath("//span[text()='Add to bag']").click(); 103 | } 104 | 105 | // 10) Mouse over on Your Bag and Click on "Go to Bag" 106 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[text()='Go to bag']"))); 107 | driver.findElementByXPath("//div[text()='Go to bag']").click(); 108 | 109 | // 11) Capture the Estimated Deliver Date and print 110 | System.out.println(driver.findElementByXPath("//div[@data-id='delivery-estimation']/span").getText()); 111 | 112 | // 12) Mouse over on FREE DELIVERY & RETURNS*, get the tool tip text and print 113 | 114 | builder.moveToElement(driver.findElementByXPath("//a[text()='Free delivery and returns*']")).perform(); 115 | System.out.println( 116 | driver.findElementByXPath("//a[text()='Free delivery and returns*']/..").getAttribute("title")); 117 | // 13) Click on FREE DELIVERY & RETURNS 118 | driver.findElementByXPath("//a[text()='Free delivery and returns*']").click(); 119 | // 14) Click on Start chat in the Start chat and go to the new window 120 | // Thread.sleep(5000); 121 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Start chat']"))); 122 | driver.findElementByXPath("//span[text()='Start chat']").click(); 123 | Set windowSet = driver.getWindowHandles(); 124 | List windowList = new ArrayList<>(windowSet); 125 | driver.switchTo().window(windowList.get(1)); 126 | // 15) Enter you first name and a dummy email and click Start Chat 127 | driver.findElementById("prechat_customer_name_id").sendKeys("Sanjay"); 128 | driver.findElementById("prechat_customer_email_id").sendKeys("msankrish@gmail.com"); 129 | driver.findElementByXPath("//span[text()='Start Chat']").click(); 130 | // 16) Type Hi, click Send and print thr reply message and close the chat window. 131 | wait.until(ExpectedConditions 132 | .visibilityOfElementLocated(By.xpath("//span[contains(text(),'Please write your')]"))); 133 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("liveAgentChatTextArea"))); 134 | driver.findElementById("liveAgentChatTextArea").sendKeys("Hi"); 135 | driver.findElementByXPath("//button[text()='Send']").click(); 136 | wait.until(ExpectedConditions 137 | .visibilityOfElementLocated(By.xpath("//span[@class='client']/following-sibling::span/span[2]"))); 138 | System.out.println( 139 | driver.findElementByXPath("//span[@class='client']/following-sibling::span/span[2]").getText()); 140 | 141 | } 142 | 143 | } -------------------------------------------------------------------------------- /src/main/java/testCases/Day16ajio.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.JavascriptExecutor; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.chrome.ChromeOptions; 11 | import org.openqa.selenium.interactions.Actions; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | import org.openqa.selenium.support.ui.ExpectedConditions; 14 | import org.openqa.selenium.support.ui.Select; 15 | import org.openqa.selenium.support.ui.WebDriverWait; 16 | import org.testng.Assert; 17 | 18 | public class Day16ajio { 19 | 20 | public static void main(String[] args) { 21 | // 1) Go to //www.ajio.com/shop/sale 22 | 23 | ChromeOptions ops = new ChromeOptions(); 24 | ops.addArguments("--disable-notifications"); 25 | 26 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 27 | RemoteWebDriver driver = new ChromeDriver(ops); 28 | driver.manage().window().maximize(); 29 | driver.get("https://www.ajio.com/shop/sale"); 30 | WebDriverWait wait = new WebDriverWait(driver, 15); 31 | 32 | // 2) Enter Bags in the Search field and Select Bags in Women Handbags 33 | driver.findElementByXPath("//input[@placeholder='Search AJIO']").sendKeys("Bags"); 34 | 35 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Women Handbags']"))); 36 | driver.findElementByXPath("//span[text()='Women Handbags']").click(); 37 | 38 | // 3) Click on five grid and Select SORT BY as "What's New" 39 | driver.findElementByXPath("//div[@class='five-grid']").click(); 40 | Select dropDown = new Select(driver.findElementByXPath("//div[@class='filter-dropdown']/select")); 41 | dropDown.selectByVisibleText("What's New"); 42 | 43 | // 4) Enter Price Range Min as 2500 and Max as 5000 44 | JavascriptExecutor js = (JavascriptExecutor) driver; 45 | js.executeScript("window.scrollBy(0,250)", ""); 46 | driver.findElementByXPath("//span[text()='price']").click(); 47 | driver.findElementByXPath("//input[@id='minPrice']").sendKeys("2500"); 48 | driver.findElementByXPath("//input[@id='maxPrice']").sendKeys("5000"); 49 | driver.findElementByXPath("//input[@id='maxPrice']/following-sibling::button").click(); 50 | 51 | // 5) Click on the product "Puma Ferrari LS Shoulder Bag" 52 | wait.until(ExpectedConditions.textToBe( 53 | By.xpath("//div[@role='rowgroup']/div[2]//div//div/following-sibling::div/div[2]"), 54 | "Ferrari LS Shoulder Bag")); 55 | driver.findElementByXPath("//div[text()='Ferrari LS Shoulder Bag']").click(); 56 | Set windowHandles = driver.getWindowHandles(); 57 | List windowHandlesList = new ArrayList(windowHandles); 58 | driver.switchTo().window(windowHandlesList.get(1)); 59 | 60 | // 6) Verify the Coupon code for the price above 2690 is applicable for your product, if applicable then get the Coupon Code and Calculate the discount price for the coupon 61 | String disAppPrice = driver.findElementByXPath("//div[@class='promo-desc']").getText(); 62 | String disAppPriceSub = disAppPrice.replaceAll("[^0-9]", ""); 63 | String disAppPriceSb2 = disAppPriceSub.substring(2); 64 | System.out.println("Discount only applicable for products above: " + disAppPriceSb2); 65 | int disAppPriceInt = Integer.parseInt(disAppPriceSb2); 66 | String actPrice = driver.findElementByXPath("//div[@class='prod-sp']").getText(); 67 | String actPricesub = actPrice.replaceAll("[^0-9]", ""); 68 | System.out.println("Select product Price: " + actPricesub); 69 | int actPriceInt = Integer.parseInt(actPricesub); 70 | int discountedAmount = 0; 71 | if (actPriceInt > disAppPriceInt) { 72 | System.out.println("Epic coupon applicable"); 73 | String afterDisPrice = driver.findElementByXPath("//div[@class='promo-discounted-price']/span").getText(); 74 | String afterDisPriceSub = afterDisPrice.replaceAll("[^0-9]", ""); 75 | int afterDisPriceInt = Integer.parseInt(afterDisPriceSub); 76 | 77 | discountedAmount = actPriceInt - afterDisPriceInt; 78 | 79 | } 80 | System.out.println("Calculated discount price: " + discountedAmount); 81 | 82 | // 7) Check the availability of the product for pincode 560043, print the expected delivery date if it is available 83 | 84 | driver.findElementByXPath("//span[contains(text(),\"Enter pin-code\")]").click(); 85 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@name='pincode']"))); 86 | driver.findElementByXPath("//input[@name='pincode']").sendKeys("560043"); 87 | driver.findElementByXPath("//button[@class='edd-pincode-modal-submit-btn']").click(); 88 | wait.until(ExpectedConditions 89 | .visibilityOfElementLocated(By.xpath("//ul[@class='edd-message-success-details']/li/span"))); 90 | String expDel = driver.findElementByXPath("//ul[@class='edd-message-success-details']/li/span").getText(); 91 | System.out.println("Expected Delivery: " + expDel); 92 | 93 | // 8) Click on Other Informations under Product Details and Print the Customer Care address, phone and email 94 | driver.findElementByXPath("//div[@class='other-info-toggle']").click(); 95 | String address = driver.findElementByXPath("(//span[@class='other-info'])[6]").getText(); 96 | System.out.println("Address: " + address); 97 | 98 | // 9) Click on ADD TO BAG and then GO TO BAG 99 | 100 | driver.findElementByXPath("//span[text()='ADD TO BAG']").click(); 101 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='GO TO BAG']"))); 102 | driver.findElementByXPath("//span[text()='GO TO BAG']").click(); 103 | 104 | // 10) Check the Order Total before apply coupon 105 | String orderValue = driver.findElementByXPath("//span[@class='price-value bold-font']").getText(); 106 | String orderValueSub = orderValue.replaceAll("[^0-9.]", ""); 107 | String orderValueSub2 = orderValueSub.substring(1); 108 | System.out.println("Order Value Before applying coupon: " + orderValueSub2); 109 | 110 | // 11) Enter Coupon Code and Click Apply 111 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@id='couponCodeInput']"))); 112 | driver.findElementByXPath("//input[@id='couponCodeInput']").sendKeys("EPIC"); 113 | driver.findElementByXPath("//button[text()='Apply']").click(); 114 | 115 | // 12) Verify the Coupon Savings amount(round off if it in decimal) under Order Summary and the matches the amount calculated in Product details 116 | wait.until(ExpectedConditions 117 | .visibilityOfElementLocated(By.xpath("(//span[@class='price-value discount-price'])[2]"))); 118 | String CouponSavings = driver.findElementByXPath("(//span[@class='price-value discount-price'])[2]").getText(); 119 | String CouponSavingsSub = CouponSavings.replaceAll("[^0-9.]", ""); 120 | String CouponSavingsSub1 = CouponSavingsSub.substring(1); 121 | double CouponSavingsdouble = Double.parseDouble(CouponSavingsSub1); 122 | int roundCouponSavings = (int) Math.round(CouponSavingsdouble); 123 | Assert.assertEquals(roundCouponSavings, discountedAmount); 124 | System.out.println("Coupon Savings amount matched the amount calculated in Product details"); 125 | 126 | // 13) Click on Delete and Delete the item from Bag 127 | driver.findElementByXPath("//div[@class='delete-btn']").click(); 128 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[text()='DELETE']"))); 129 | driver.findElementByXPath("//div[text()='DELETE']").click(); 130 | wait.until(ExpectedConditions.textToBe(By.xpath("//p[@class='empty-msg']"), "Your Shopping Bag is Empty!!")); 131 | 132 | // 14) Close all the browsers 133 | driver.quit(); 134 | } 135 | 136 | } 137 | 138 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day17Azure.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.io.File; 4 | 5 | import org.openqa.selenium.By; 6 | import org.openqa.selenium.JavascriptExecutor; 7 | import org.openqa.selenium.Keys; 8 | import org.openqa.selenium.chrome.ChromeDriver; 9 | import org.openqa.selenium.chrome.ChromeOptions; 10 | import org.openqa.selenium.interactions.Actions; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | import org.openqa.selenium.support.ui.ExpectedConditions; 13 | import org.openqa.selenium.support.ui.Select; 14 | import org.openqa.selenium.support.ui.WebDriverWait; 15 | 16 | public class Day17Azure { 17 | 18 | public static void main(String[] args) throws InterruptedException { 19 | 20 | // 1) Go to https://azure.microsoft.com/en-in/ 21 | 22 | ChromeOptions ops = new ChromeOptions(); 23 | ops.addArguments("--disable-notifications"); 24 | 25 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 26 | RemoteWebDriver driver = new ChromeDriver(ops); 27 | driver.manage().window().maximize(); 28 | driver.get("https://azure.microsoft.com/en-in/"); 29 | WebDriverWait wait = new WebDriverWait(driver, 30); 30 | JavascriptExecutor js = (JavascriptExecutor) driver; 31 | Actions buider = new Actions(driver); 32 | 33 | // 2) Click on Pricing 34 | driver.findElementByXPath("//a[@id='navigation-pricing']").click(); 35 | 36 | // 3) Click on Pricing Calculator 37 | driver.findElementByXPath("//a[contains(text(),'Pricing calculator')]").click(); 38 | 39 | // 4) Click on Containers 40 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[text()='Containers']"))); 41 | driver.findElementByXPath("//button[text()='Containers']").click(); 42 | 43 | // 5) Select Container Instances 44 | driver.findElementByXPath("(//span[text()='Container Instances'])[3]").click(); 45 | 46 | // 6) Click on Container Instance Added View 47 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@id='new-module-loc']"))); 48 | driver.findElementByXPath("//a[@id='new-module-loc']").click(); 49 | 50 | // 7) Select Region as "South India" 51 | Select region = new Select(driver.findElementByXPath("//select[@name='region']")); 52 | region.selectByVisibleText("South India"); 53 | 54 | // 8) Set the Duration as 180000 seconds 55 | driver.findElementByXPath("//input[@name='seconds']").sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE); 56 | driver.findElementByXPath("//input[@name='seconds']").sendKeys("180000"); 57 | 58 | // 9) Select the Memory as 4GB 59 | Select memory = new Select(driver.findElementByXPath("//select[@name='memory']")); 60 | memory.selectByVisibleText("4 GB"); 61 | 62 | // 10) Enable SHOW DEV/TEST PRICING 63 | 64 | driver.findElementByXPath("//label[@for='devtest-toggler']").click(); 65 | 66 | // 11) Select Indian Rupee as currency 67 | Select currency = new Select(driver.findElementByXPath("//select[@class='select currency-dropdown']")); 68 | currency.selectByValue("INR"); 69 | 70 | // 12) Print the Estimated monthly price 71 | String monthlyCost = driver.findElementByXPath("//span[text()='Monthly cost']/following-sibling::span/span") 72 | .getText().replaceAll("[^0-9.]", ""); 73 | System.out.println("Monthly Cost: " + monthlyCost); 74 | 75 | // 13) Click on Export to download the estimate as excel 76 | driver.findElementByXPath("//button[text()='Export']").click(); 77 | 78 | // 14) Verify the downloded file in the local folder 79 | Thread.sleep(5000); 80 | String downloadPath = "C:\\Users\\456875\\Downloads"; 81 | String fileName = "ExportedEstimate.xlsx"; 82 | 83 | File dir = new File(downloadPath); 84 | File[] dir_contents = dir.listFiles(); 85 | boolean flag = false; 86 | for (int i = 0; i < dir_contents.length; i++) { 87 | if (dir_contents[i].getName().equals(fileName)) { 88 | flag = true; 89 | } 90 | } 91 | 92 | if (flag) { 93 | System.out.println("File Verification passed"); 94 | } else { 95 | System.out.println("File Verification Failed"); 96 | } 97 | 98 | // 15) Navigate to Example Scenarios and Select CI/CD for Containers 99 | buider.moveToElement(driver.findElementByXPath("//a[text()='Example Scenarios']")).perform(); 100 | 101 | driver.findElementByXPath("//a[text()='Example Scenarios']").click(); 102 | driver.findElementByXPath("//span[text()='CI/CD for Containers']").click(); 103 | 104 | // 16) Click Add to Estimate 105 | buider.moveToElement(driver.findElementByXPath("//button[text()='Add to estimate']")).perform(); 106 | driver.findElementByXPath("//button[text()='Add to estimate']").click(); 107 | 108 | // 17) Change the Currency as Indian Rupee 109 | 110 | wait.until(ExpectedConditions.visibilityOf(driver.findElementByXPath("//h4[text()='Loading Estimate']"))); 111 | wait.until(ExpectedConditions.invisibilityOf(driver.findElementByXPath("//h4[text()='Loading Estimate']"))); 112 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//select[@class='select currency-dropdown']"))); 113 | Select currency2 = new Select(driver.findElementByXPath("//select[@class='select currency-dropdown']")); 114 | currency2.selectByValue("INR"); 115 | 116 | // 18) Enable SHOW DEV/TEST PRICING 117 | driver.findElementByXPath("//label[@for='devtest-toggler']").click(); 118 | 119 | // 19) Export the Estimate 120 | driver.findElementByXPath("//button[text()='Export']").click(); 121 | 122 | // 20) Verify the downloded file in the local folder 123 | String fileName2 = "ExportedEstimate (1).xlsx"; 124 | 125 | flag = false; 126 | for (int i = 0; i < dir_contents.length; i++) { 127 | if (dir_contents[i].getName().equals(fileName2)) { 128 | flag = true; 129 | } 130 | } 131 | 132 | if (flag) { 133 | System.out.println("File Verification passed"); 134 | } else { 135 | System.out.println("File Verification Failed"); 136 | } 137 | 138 | } 139 | 140 | 141 | } 142 | 143 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day1MyntraApp.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.openqa.selenium.WebDriver; 8 | import org.openqa.selenium.WebElement; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.chrome.ChromeOptions; 11 | import org.openqa.selenium.interactions.Action; 12 | import org.openqa.selenium.interactions.Actions; 13 | import org.openqa.selenium.interactions.Keyboard; 14 | import org.openqa.selenium.interactions.Mouse; 15 | import org.openqa.selenium.remote.RemoteWebDriver; 16 | import org.testng.Assert; 17 | 18 | public class Day1MyntraApp { 19 | 20 | public static void main(String[] args) throws InterruptedException { 21 | 22 | ChromeOptions option = new ChromeOptions(); 23 | 24 | option.addArguments("--disable-notifications"); 25 | 26 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 27 | RemoteWebDriver driver = new ChromeDriver(option); 28 | 29 | driver.get("https://www.myntra.com/"); 30 | 31 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 32 | 33 | WebElement womenMouseOverElement = driver 34 | .findElementByXPath("(//div[@class=\"desktop-navLink\"]/a)[position()=2]"); 35 | 36 | Actions builder = new Actions(driver); 37 | 38 | builder.moveToElement(womenMouseOverElement).perform(); 39 | 40 | driver.findElementByXPath("//a[text()=\"Jackets & Coats\"]").click(); 41 | 42 | String titleCount = driver.findElementByXPath("//span[@class=\"title-count\"]").getText(); 43 | 44 | String countInString = titleCount.replaceAll("\\D", ""); 45 | 46 | int intCount = Integer.parseInt(countInString); 47 | 48 | String jacketCount = driver.findElementByXPath("//span[@class=\"categories-num\"]").getText(); 49 | 50 | // System.out.println(jacketCount); 51 | String stringJacketCount = jacketCount.replaceAll("\\D", ""); 52 | // System.out.println(stringJacketCount); 53 | String coatCount = driver.findElementByXPath("(//span[@class=\"categories-num\"])[2]").getText(); 54 | 55 | String stringCountCount = coatCount.replaceAll("\\D", ""); 56 | 57 | // System.out.println(stringJacketCount); 58 | 59 | int intJacketCount = Integer.parseInt(stringJacketCount); 60 | 61 | int intCoatCount = Integer.parseInt(stringCountCount); 62 | 63 | int totalJacketCoatCount = intJacketCount + intCoatCount; 64 | 65 | Assert.assertEquals(intCount,totalJacketCoatCount); 66 | 67 | driver.findElementByXPath("(//span[@class=\"categories-num\"]/following-sibling::div)[2]").click(); 68 | 69 | driver.findElementByXPath("//div[@class=\"brand-more\"]").click(); 70 | 71 | driver.findElementByXPath("//input[@class=\"FilterDirectory-searchInput\"]").sendKeys("Mango"); 72 | 73 | driver.findElementByXPath("//span[@class=\"FilterDirectory-count\"]/following-sibling::div").click(); 74 | 75 | driver.findElementByXPath("//ul[@class=\"FilterDirectory-indices\"]/following-sibling::span").click(); 76 | 77 | Thread.sleep(5000); 78 | 79 | List BrandList = new ArrayList(); 80 | 81 | BrandList = driver.findElementsByXPath("//h3[@class=\"product-brand\"]"); 82 | 83 | int totalBrandCount = BrandList.size(); 84 | 85 | for (int i = 0; i < totalBrandCount; i++) { 86 | String brand = BrandList.get(i).getText(); 87 | Assert.assertEquals(brand, "MANGO"); 88 | } 89 | 90 | builder.moveToElement(driver.findElementByXPath("//div[@class=\"sort-sortBy\"]")).perform(); 91 | 92 | driver.findElementByXPath("//label[text()=\"Better Discount\"]").click(); 93 | 94 | Thread.sleep(5000); 95 | 96 | builder.moveToElement(driver.findElementByXPath("//h3[@class=\"product-brand\"]")).perform(); 97 | 98 | driver.findElementByXPath("//div[@class=\"product-actions product-prelaunchActions\"]/span").click(); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day2NykaaApp.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.awt.Window; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.Set; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import org.openqa.selenium.WebDriver; 10 | import org.openqa.selenium.chrome.ChromeDriver; 11 | import org.openqa.selenium.interactions.Actions; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | 14 | public class Day2NykaaApp { 15 | 16 | /** 17 | * 1) Go to https://www.nykaa.com/ 2) Mouseover on Brands and Mouseover on 18 | * Popular 3) Click L'Oreal Paris 4) Go to the newly opened window and check the 19 | * title contains L'Oreal Paris 5) Click sort By and select customer top rated 20 | * 6) Click Category and click Shampoo 7) check whether the Filter is applied 21 | * with Shampoo 8) Click on L'Oreal Paris Colour Protect Shampoo 9) GO to the 22 | * new window and select size as 175ml 10) Print the MRP of the product 11) 23 | * Click on ADD to BAG 12) Go to Shopping Bag 13) Print the Grand Total amount 24 | * 14) Click Proceed 15) Click on Continue as Guest 16) Print the warning 25 | * message (delay in shipment) 17) Close all windows 26 | * 27 | * @param args 28 | * @throws InterruptedException 29 | */ 30 | 31 | public static void main(String[] args) throws InterruptedException { 32 | // 1) Go to https://www.nykaa.com/ 33 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 34 | 35 | RemoteWebDriver driver = new ChromeDriver(); 36 | 37 | driver.manage().window().maximize(); 38 | 39 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 40 | 41 | driver.get("https://www.nykaa.com/"); 42 | // 2) Mouseover on Brands and Mouseover on Popular 43 | Actions builder = new Actions(driver); 44 | 45 | builder.moveToElement(driver.findElementByXPath("//a[text()=\"brands\"]")).perform(); 46 | 47 | builder.moveToElement(driver.findElementByXPath("//a[text()=\"Popular\"]")).perform(); 48 | // 3) Click L'Oreal Paris 49 | driver.findElementByXPath("(//li[@class=\"brand-logo menu-links\"]//img)[5]").click(); 50 | 51 | Thread.sleep(5000); 52 | // 4) Go to the newly opened window and check the title contains L'Oreal Paris 53 | Set windows = driver.getWindowHandles(); 54 | 55 | List orderedWindow = new ArrayList(windows); 56 | 57 | driver.switchTo().window(orderedWindow.get(1)); 58 | 59 | if (driver.getTitle().contains("L'Oreal Paris")) { 60 | System.out.println("Title Matched"); 61 | } 62 | 63 | Thread.sleep(5000); 64 | try { 65 | driver.findElementByXPath("//button[text()=\"Maybe later\"]").click(); 66 | } catch (Exception e) { 67 | System.out.println(e); 68 | } 69 | Thread.sleep(5000); 70 | 71 | // 5) Click sort By and select customer top rated 72 | 73 | builder.moveToElement(driver.findElementByXPath("//span[text()=\"Sort By : \"]")).perform(); 74 | 75 | driver.findElementByXPath("//span[@class=\"pull-left\"]").click(); 76 | 77 | driver.findElementByXPath("//span[text()=\"customer top rated\"]").click(); 78 | 79 | Thread.sleep(5000); 80 | // 6) Click Category and click Shampoo 81 | 82 | driver.findElementByXPath("//div[text()=\"Category\"]").click(); 83 | 84 | driver.findElementByXPath("//input[@id=\"chk_Shampoo_undefined\"]/following-sibling::label").click(); 85 | 86 | Thread.sleep(3000); 87 | // 7) check whether the Filter is applied with Shampoo 88 | String filterText = driver.findElementByXPath("//ul[@class=\"pull-left applied-filter-lists\"]/li").getText(); 89 | 90 | if (filterText.contains("Shampoo")) { 91 | System.out.println("Filter Applied"); 92 | } 93 | 94 | // 8) Click on L'Oreal Paris Colour Protect Shampoo 95 | 96 | driver.findElementByXPath("//span[contains(text(),\"Paris Colour Protect Shampoo\")]").click(); 97 | 98 | // GO to the new window and select size as 175ml 99 | 100 | Set window2 = driver.getWindowHandles(); 101 | 102 | List orderedWindow2 = new ArrayList(window2); 103 | 104 | driver.switchTo().window(orderedWindow2.get(2)); 105 | 106 | Thread.sleep(5000); 107 | 108 | driver.findElementByXPath("//span[text()=\"175ml\"]").click(); 109 | 110 | // 10) Print the MRP of the product 111 | 112 | String actualMrpText = driver.findElementByXPath("(//span[@class=\"post-card__content-price-offer\"])[1]") 113 | .getText(); 114 | 115 | String trimmedMrpText = actualMrpText.replaceAll("[^0-9]", ""); 116 | 117 | System.out.println("Mrp is " + trimmedMrpText); 118 | 119 | // 11) Click on ADD to BAG 120 | 121 | driver.findElementByXPath("//div[@class=\"pull-left\"]//button").click(); 122 | 123 | // 12) Go to Shopping Bag 124 | 125 | driver.findElementByXPath("//div[@class=\"AddBagIcon\"]").click(); 126 | 127 | Thread.sleep(3000); 128 | // 13) Print the Grand Total amount 129 | String grandTotal = driver.findElementByXPath("//div[@class=\"value medium-strong\"]").getText(); 130 | 131 | String TrimmedGrandTotal = grandTotal.replaceAll("[^0-9]", ""); 132 | 133 | System.out.println("Grand Total = " + TrimmedGrandTotal); 134 | // 14) Click Proceed 135 | 136 | driver.findElementByXPath("//span[text()=\"Proceed\"]").click(); 137 | // 15) Click on Continue as Guest 138 | driver.findElementByXPath("//button[contains(text(),\"CONTINUE AS GUEST\")]").click(); 139 | 140 | String message = driver.findElementByXPath("//div[@class=\"message\"]").getText(); 141 | // 16) Print the warning message (delay in shipment) 142 | System.out.println(message); 143 | // 17) Close all windows 144 | driver.quit(); 145 | 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day3MakeMyTrip.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import org.openqa.selenium.chrome.ChromeDriver; 9 | import org.openqa.selenium.remote.RemoteWebDriver; 10 | import org.openqa.selenium.support.ui.Select; 11 | 12 | public class Day3MakeMyTrip { 13 | 14 | public static void main(String[] args) throws InterruptedException { 15 | 16 | // 1) Go to https://www.makemytrip.com/ 17 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 18 | RemoteWebDriver driver = new ChromeDriver(); 19 | driver.manage().window().maximize(); 20 | driver.navigate().to("https://www.makemytrip.com/"); 21 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 22 | 23 | // 2) Click Hotels 24 | driver.findElementByXPath("//span[text()=\"Hotels\"]").click(); 25 | 26 | // 3) Enter city as Goa, and choose Goa, India 27 | driver.findElementByXPath("//input[@id=\"city\"]").click(); 28 | Thread.sleep(3000); 29 | driver.findElementByXPath("//div[@id=\"react-autowhatever-1\"]/preceding-sibling::input").sendKeys("Goa"); 30 | driver.findElementByXPath("//p[text()=\"Goa, India\"]").click(); 31 | Thread.sleep(3000); 32 | 33 | // Enter Check in date as Next month 15th (May 15) and Check out as start date+5 34 | driver.findElementByXPath("(//div[text()=\"25\"])[2]").click(); 35 | String startDate = driver.findElementByXPath("//div[contains(@class,\"start DayPicker-Day\")]").getText(); 36 | int endDate = Integer.parseInt(startDate) + 5; 37 | driver.findElementByXPath("(//div[text()=" + endDate + "])[2]").click(); 38 | 39 | // 5) Click on ROOMS & GUESTS and click 2 Adults and one Children(age 12). Click Apply Button. 40 | driver.findElementById("guest").click(); 41 | driver.findElementByXPath("//li[text()=\"2\"]").click(); 42 | driver.findElementByXPath("(//li[text()=\"1\"])[2]").click(); 43 | Select childAge = new Select(driver.findElementById("0")); 44 | childAge.selectByVisibleText("12"); 45 | driver.findElementByXPath("//button[text()=\"APPLY\"]").click(); 46 | 47 | // 6) Click Search button 48 | driver.findElementById("hsw_search_button").click(); 49 | 50 | // 7) Select locality as Baga 51 | Thread.sleep(5000); 52 | driver.findElementByXPath("//a[@class=\"mapCont\"]").click(); 53 | Thread.sleep(3000); 54 | driver.findElementByXPath("//span[@class=\"mapClose\"]").click(); 55 | Thread.sleep(3000); 56 | driver.switchTo().frame("notification-frame-3175461c"); 57 | driver.findElementByXPath("//div[@class=\"minimize tablecell\"]/i").click(); 58 | Thread.sleep(3000); 59 | driver.switchTo().defaultContent(); 60 | Thread.sleep(3000); 61 | driver.findElementByXPath("//input[@id=\"mmLocality_checkbox_35\"]/following-sibling::label").click(); 62 | 63 | // 8) Select 5 start in Star Category under Select Filters 64 | Thread.sleep(3000); 65 | driver.findElementByXPath("//label[text()=\"5 Star\"]").click(); 66 | 67 | // 9) Click on the first resulting hotel and go to the new window 68 | Thread.sleep(2000); 69 | driver.findElementById("Listing_hotel_0").click(); 70 | Set windows = driver.getWindowHandles(); 71 | List orderedWindow = new ArrayList(windows); 72 | driver.switchTo().window(orderedWindow.get(1)); 73 | 74 | // 10) Print the Hotel Name 75 | Thread.sleep(2000); 76 | System.out.println(driver.findElementById("detpg_hotel_name").getText()); 77 | 78 | // 11) Click MORE OPTIONS link and Select 3Months plan and close 79 | driver.findElementByXPath("//span[text()=\"MORE OPTIONS\"]").click(); 80 | driver.findElementByXPath("//span[text()=\"SELECT\"]").click(); 81 | driver.findElementByXPath("//span[@class=\"close\"]").click(); 82 | 83 | // 12) Click on BOOK THIS NOW 84 | driver.findElementByLinkText("BOOK THIS NOW").click(); 85 | Thread.sleep(3000); 86 | driver.findElementByXPath("//span[@class=\"close\"]").click(); 87 | 88 | // 13) Print the Total Payable amount 89 | String totalAmount = driver.findElementById("revpg_total_payable_amt").getText(); 90 | String trimTotalAmount = totalAmount.replaceAll("[^0-9]", ""); 91 | System.out.println(trimTotalAmount); 92 | 93 | // 14) Close the browser 94 | driver.quit(); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day4HP.java: -------------------------------------------------------------------------------- 1 | 2 | package testCases; 3 | 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import org.openqa.selenium.By; 7 | import org.openqa.selenium.WebElement; 8 | import org.openqa.selenium.chrome.ChromeDriver; 9 | import org.openqa.selenium.chrome.ChromeOptions; 10 | import org.openqa.selenium.interactions.Actions; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | import org.openqa.selenium.support.ui.ExpectedConditions; 13 | import org.openqa.selenium.support.ui.Select; 14 | import org.openqa.selenium.support.ui.WebDriverWait; 15 | import org.testng.Assert; 16 | 17 | public class Day4HP { 18 | 19 | public static void main(String[] args) throws InterruptedException { 20 | // 1) Go to https://store.hp.com/in-en/ 21 | ChromeOptions option = new ChromeOptions(); 22 | 23 | option.addArguments("--disable-notifications"); 24 | 25 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 26 | RemoteWebDriver driver = new ChromeDriver(); 27 | driver.get("https://store.hp.com/in-en/"); 28 | driver.manage().window().maximize(); 29 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 30 | 31 | // 2) Mouse over on Laptops menu and click on Pavilion 32 | try { 33 | Thread.sleep(500); 34 | WebDriverWait wait = new WebDriverWait(driver, 30); 35 | wait.until(ExpectedConditions.textToBe( 36 | By.xpath("//button[@class=\"optanon-allow-all accept-cookies-button\"]"), "Accept Cookies")); 37 | Thread.sleep(500); 38 | System.out.println(driver.findElementByXPath("//button[@class=\"optanon-allow-all accept-cookies-button\"]") 39 | .getText()); 40 | driver.findElementByXPath("//button[@class=\"optanon-allow-all accept-cookies-button\"]").click(); 41 | } catch (Exception e) { 42 | System.out.println("No Cookie window"); 43 | } 44 | try { 45 | 46 | Thread.sleep(500); 47 | WebDriverWait wait = new WebDriverWait(driver, 30); 48 | wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("ifr_popup")); 49 | wait.until(ExpectedConditions.textToBe(By.xpath("//h2[@class=\"marketing_header\"]"), "SIGN UP NOW!")); 50 | System.out.println(driver.findElementByXPath("//h2[@class=\"marketing_header\"]").getText()); 51 | System.out.println("Frame Available"); 52 | driver.switchTo().defaultContent(); 53 | Thread.sleep(2000); 54 | driver.findElementByXPath("//span[@class=\"optly-modal-close close-icon\"]").click(); 55 | } catch (Exception e) { 56 | System.out.println("No Sign Up window"); 57 | } 58 | 59 | Actions act = new Actions(driver); 60 | act.moveToElement(driver.findElementByXPath("(//span[text()=\"Laptops\"])[1]")).perform(); 61 | driver.findElementByXPath("(//span[text()=\"Pavilion\"])[1]").click(); 62 | 63 | // 3) Under SHOPPING OPTIONS -->Processor -->Select Intel Core i7 64 | try { 65 | WebDriverWait wait = new WebDriverWait(driver, 50); 66 | wait.until(ExpectedConditions 67 | .elementToBeClickable(By.xpath("//div[@class=\"inside_closeButton fonticon icon-hclose\"]"))); 68 | driver.findElementByXPath("//div[@class=\"inside_closeButton fonticon icon-hclose\"]").click(); 69 | } catch (Exception e) { 70 | System.out.println("Element not present"); 71 | } 72 | Thread.sleep(3000); 73 | driver.findElementByXPath("(//span[text()=\"Processor\"])[2]").click(); 74 | Thread.sleep(2000); 75 | driver.findElementByXPath("//span[text()=\"Intel Core i7\"]/preceding-sibling::input").click(); 76 | 77 | // 4) Hard Drive Capacity -->More than 1TB 78 | 79 | Thread.sleep(3000); 80 | driver.findElementByXPath("//span[text()=\"More than 1 TB\"]/preceding-sibling::input").click(); 81 | 82 | // 5) Select Sort By: Price: Low to High 83 | Thread.sleep(3000); 84 | Select sort = new Select(driver.findElementById("sorter")); 85 | sort.selectByValue("price_asc"); 86 | // 6) Print the First resulting Product Name and Price 87 | Thread.sleep(5000); 88 | String productName = driver.findElementByXPath("//strong[@class=\"product name product-item-name\"]/a") 89 | .getText(); 90 | String productPrice = driver.findElementByXPath("//span[@id=\"product-price-9580\"]/span").getText(); 91 | String trimProductPrice = productPrice.replaceAll("[^0-9]", ""); 92 | System.out.println(productName + " " + trimProductPrice); 93 | // 7) Click on Add to Cart 94 | 95 | driver.findElementByXPath("//span[text()=\"Add To Cart\"]").click(); 96 | 97 | // 8) Click on Shopping Cart icon --> Click on View and Edit Cart 98 | 99 | Thread.sleep(2000); 100 | driver.findElementByXPath("//div[@class=\"minicart-wrapper\"]/a").click(); 101 | driver.findElementByXPath("//span[text()=\"View and edit cart\"]/..").click(); 102 | // 9) Check the Shipping Option --> Check availability at Pincode 103 | driver.findElementByXPath("//input[@name=\"pincode\"]").sendKeys("600100"); 104 | driver.findElementByXPath("//button[text()=\"check\"]").click(); 105 | // 10) Verify the order Total against the product price 106 | String orderValue = driver.findElementByXPath("//tr[@class=\"grand totals\"]/td/strong/span").getText(); 107 | String trimOrderValue = orderValue.replaceAll("[^0-9]", ""); 108 | System.out.println(trimOrderValue); 109 | Assert.assertEquals(trimProductPrice, trimOrderValue); 110 | // 11) Proceed to Checkout if Order Total and Product Price matches 111 | Thread.sleep(2000); 112 | driver.findElementById("sendIsCAC").click(); 113 | // 12) Click on Place Order 114 | driver.findElementByXPath("(//span[text()=\"Place Order\"])[4]").click(); 115 | // 13) Capture the Error message and Print 116 | System.out.println(driver.findElementByXPath("//div[@class=\"message notice\"]/span").getText()); 117 | // 14) Close Browser 118 | driver.close(); 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day5PostMan.java: -------------------------------------------------------------------------------- 1 | //package testCases; 2 | // 3 | //import java.net.MalformedURLException; 4 | //import java.net.URL; 5 | // 6 | //import org.openqa.selenium.chrome.ChromeDriver; 7 | //import org.openqa.selenium.remote.RemoteWebDriver; 8 | //import org.openqa.selenium.winium.DesktopOptions; 9 | //import org.openqa.selenium.winium.WiniumDriver; 10 | // 11 | //public class Day5PostMan { 12 | // 13 | // public static void main(String[] args) throws MalformedURLException, InterruptedException { 14 | // 15 | //// 1) Open Postman desktop application using Selenium 16 | // DesktopOptions option = new DesktopOptions(); 17 | // 18 | // option.setApplicationPath("C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 19 | // 20 | // WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"), option); 21 | // 22 | // 23 | //// 2) Create New Collection as RestLearning 24 | // Thread.sleep(5000); 25 | //// driver.findElementByClassName("Chrome_RenderWidgetHostHWND").click(); 26 | // driver.findElementByXPath("//div[@class=\"btn btn-primary\"]").click(); 27 | //// 3) Check whether the collection already exist 28 | //// 4) If exist, delete the existing Collection 29 | //// 5) Create new Collection 30 | // } 31 | // 32 | // 33 | // 34 | //} 35 | // 36 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day6BigBasket.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.Keys; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.interactions.Actions; 8 | import org.openqa.selenium.remote.RemoteWebDriver; 9 | 10 | import org.testng.Assert; 11 | 12 | public class Day6BigBasket { 13 | 14 | public static void main(String[] args) throws InterruptedException { 15 | 16 | // 1) Go to https://www.bigbasket.com/ 17 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 18 | RemoteWebDriver driver = new ChromeDriver(); 19 | driver.get("https://www.bigbasket.com/"); 20 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 21 | driver.manage().window().maximize(); 22 | driver.findElementByClassName("arrow-marker").click(); 23 | driver.findElementByName("skipandexplore").click(); 24 | 25 | // 2) mouse over on Shop by Category 26 | Thread.sleep(2000); 27 | Actions builder = new Actions(driver); 28 | builder.moveToElement(driver.findElementByXPath("//li[@class=\"dropdown full-wid hvr-drop\"]/a")).perform(); 29 | 30 | // 3)Go to FOODGRAINS, OIL & MASALA --> RICE & RICE PRODUCTS 31 | // Thread.sleep(3000); 32 | builder.moveToElement(driver.findElementByXPath("(//a[contains(text(),\"Foodgrains, Oil & Masala\")])[2]")) 33 | .perform(); 34 | builder.moveToElement(driver.findElementByXPath("(//a[contains(text(),\"Rice & Rice Products\")])[2]")) 35 | .perform(); 36 | 37 | // 4) Click on Boiled & Steam Rice 38 | driver.findElementByXPath("(//a[contains(text(),\"Boiled & Steam Rice\")])[2]").click(); 39 | 40 | // 5) Choose the Brand as bb Royal 41 | driver.findElementByXPath("(//i[@class=\"cr-icon fa fa-check\"])[3]").click(); 42 | 43 | // 6) Go to Ponni Boiled Rice - Super Premium and select 5kg bag from Dropdown 44 | Thread.sleep(5000); 45 | driver.findElementByXPath("(//button[@class=\"btn btn-default dropdown-toggle form-control\"]/i)[3]").click(); 46 | driver.findElementByXPath( 47 | "//a[text()=\"Ponni Boiled Rice - Super Premium\"]/following::div/div/span/ul/li/a/span").click(); 48 | 49 | // 7) print the price of Rice 50 | String ricePrice = driver.findElementByXPath("(//span[@class=\"discnt-price\"]/span)[3]").getText(); 51 | System.out.println("Price of the Rice is: " + ricePrice); 52 | int intRicePrice = Integer.parseInt(ricePrice); 53 | 54 | // 8) Click Add button 55 | driver.findElementByXPath("(//button[text()=\"Add \"])[3]").click(); 56 | 57 | // 9) Verify the success message displayed 58 | System.out.println(driver.findElementByClassName("toast-title").getText()); 59 | 60 | // 10) Type Dal in Search field and enter 61 | driver.findElementById("input").sendKeys("dhal", Keys.ENTER); 62 | 63 | // 12) Go to Toor/Arhar Dal and select 2kg & set Qty 2 64 | driver.findElementByXPath("//a[text()=\"Organic - Toor Dal / Thuvaram Paruppu\"]/following::div/span/button") 65 | .click(); 66 | driver.findElementByXPath( 67 | "//a[text()=\"Organic - Toor Dal / Thuvaram Paruppu\"]/following::div/span/button/following-sibling::ul/li/a") 68 | .click(); 69 | driver.findElementByXPath( 70 | "//a[text()=\"Organic - Toor Dal / Thuvaram Paruppu\"]/following::div[3]//div[3]/div[2]/div[1]/div/input") 71 | .clear(); 72 | driver.findElementByXPath( 73 | "//a[text()=\"Organic - Toor Dal / Thuvaram Paruppu\"]/following::div[3]//div[3]/div[2]/div[1]/div/input") 74 | .sendKeys("2"); 75 | 76 | // 13) Print the price of Dal 77 | String dalPrice = driver.findElementByXPath("(//span[@class=\"discnt-price\"])[4]").getText(); 78 | System.out.println("Price of Dhal is " + dalPrice); 79 | int intDalPrice = Integer.parseInt(dalPrice.replaceAll("[^0-9]", "")); 80 | 81 | // 14) Click Add button 82 | driver.findElementByXPath( 83 | "//a[text()=\"Organic - Toor Dal / Thuvaram Paruppu\"]/following::div[3]//div[3]/div[2]/div[2]/button") 84 | .click(); 85 | 86 | // 15) Mouse hover on My Basket 87 | builder.moveToElement(driver.findElementByXPath("//span[@class=\"basket-content\"]")).perform(); 88 | 89 | // 16) Validate the Sub Total displayed for the selected items 90 | String subTotal = driver.findElementByXPath("//div[@class=\"row sub-cost ng-scope\"]/p/span/span").getText(); 91 | int Total = intRicePrice + (intDalPrice * 2); 92 | System.out.println("Sub total is " + subTotal); 93 | System.out.println("Total is " + Total); 94 | int intSubTotal = Integer.parseInt(subTotal.replaceAll("[^1-9]", "")); 95 | Assert.assertEquals(Total, intSubTotal); 96 | System.out.println("Total Mached"); 97 | 98 | // 17) Reduce the Quantity of Dal as 1 99 | driver.findElementByXPath("(//div[@class=\"btn-counter row\"]/button)[3]").click(); 100 | // 18) Validate the Sub Total for the current items 101 | Thread.sleep(2000); 102 | subTotal = driver.findElementByXPath("//div[@class=\"row sub-cost ng-scope\"]/p/span/span").getText(); 103 | Total = intRicePrice + intDalPrice; 104 | System.out.println("Sub total is " + subTotal); 105 | System.out.println("Total is " + Total); 106 | intSubTotal = Integer.parseInt(subTotal.replaceAll("[^1-9]", "")); 107 | Assert.assertEquals(Total, intSubTotal); 108 | System.out.println("Total Mached"); 109 | 110 | // 19) Close the Browser 111 | driver.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day7Honda.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import org.openqa.selenium.By; 9 | import org.openqa.selenium.WebElement; 10 | import org.openqa.selenium.chrome.ChromeDriver; 11 | import org.openqa.selenium.interactions.Actions; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | import org.openqa.selenium.support.ui.Select; 14 | import org.testng.Assert; 15 | 16 | public class Day7Honda { 17 | 18 | public static void main(String[] args) throws InterruptedException { 19 | 20 | // 1) Go to https://www.honda2wheelersindia.com/ 21 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 22 | RemoteWebDriver driver = new ChromeDriver(); 23 | driver.manage().window().maximize(); 24 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 25 | driver.get("https://www.honda2wheelersindia.com/"); 26 | driver.findElementByXPath("//button[@class=\"close\"]").click(); 27 | 28 | // 2) Click on scooters and click dio 29 | driver.findElementById("link_Scooter").click(); 30 | Thread.sleep(2000); 31 | driver.findElementByXPath("//div[@id=\"scooter\"]//div//div//div//a").click(); 32 | 33 | // 3) Click on Specifications and mouseover on ENGINE 34 | driver.findElementByXPath("//a[text()=\"Specifications\"]").click(); 35 | Thread.sleep(3000); 36 | driver.findElementByXPath("//a[text()=\"ENGINE\"]").click(); 37 | 38 | // 4) Get Displacement value 39 | String dioDisplacement = driver.findElementByXPath("//span[text()=\"Displacement\"]/following-sibling::span") 40 | .getText(); 41 | double intDioDisplacement = Double.parseDouble(dioDisplacement.replaceAll("[^0-9.]", "")); 42 | String dioName = driver.getTitle(); 43 | String exactDioName = dioName.substring(17); 44 | System.out.println("Displacement of " + exactDioName + " " + intDioDisplacement); 45 | 46 | // 5) Go to Scooters and click Activa 125 47 | driver.findElementById("link_Scooter").click(); 48 | driver.findElementByXPath("(//div[@id=\"scooter\"]//div//div//div//a)[3]").click(); 49 | 50 | // 6) Click on Specifications and mouseover on ENGINE 51 | driver.findElementByXPath("//a[text()=\"Specifications\"]").click(); 52 | Thread.sleep(3000); 53 | driver.findElementByXPath("//a[text()=\"ENGINE\"]").click(); 54 | 55 | // 7) Get Displacement value 56 | String activaDisplacement = driver.findElementByXPath("//span[text()=\"Displacement\"]/following-sibling::span") 57 | .getText(); 58 | double intActivaDisplacement = Double.parseDouble(activaDisplacement.replaceAll("[^0-9.]", "")); 59 | String activaName = driver.getTitle(); 60 | String exactActivaName = activaName.substring(17); 61 | System.out.println("Displacement of " + exactActivaName + " " + intDioDisplacement); 62 | 63 | // 8) Compare Displacement of Dio and Activa 125 and print the Scooter name having better Displacement. 64 | String BetterDisplacement; 65 | if (intActivaDisplacement > intDioDisplacement) { 66 | BetterDisplacement = exactActivaName; 67 | System.out.println("The Scooter that has better displacement is " + BetterDisplacement); 68 | } else { 69 | BetterDisplacement = exactDioName; 70 | System.out.println("The Scooter that has better displacement is " + BetterDisplacement); 71 | } 72 | 73 | // 9) Click FAQ from Menu 74 | driver.findElementByXPath("//a[text()=\"FAQ\"]").click(); 75 | 76 | // 10) Click Activa 125 BS-VI under Browse By Product 77 | driver.findElementByXPath("(//div[@id='style-3'])[2]//a[contains(text(),'125 BS-VI')]").click(); 78 | 79 | // 11) Click Vehicle Price 80 | driver.findElementByXPath("//li[@id='li6']/a").click(); 81 | 82 | // 12) Make sure Activa 125 BS-VI selected and click submit 83 | Select sel = new Select(driver.findElementById("ModelID6")); 84 | List allSelectedOptions = sel.getAllSelectedOptions(); 85 | String selected = allSelectedOptions.get(0).getText(); 86 | Assert.assertEquals(selected, "Activa 125 BS-VI"); 87 | System.out.println(selected + " Selected"); 88 | driver.findElementById("submit6").click(); 89 | 90 | // 13) click the price link 91 | driver.findElementByXPath("//a[contains(text(),'Click here to know the price')]").click(); 92 | 93 | // 14) Go to the new Window and select the state as Tamil Nadu and city as Chennai 94 | Set handles = driver.getWindowHandles(); 95 | List orderHandles = new ArrayList(handles); 96 | driver.switchTo().window(orderHandles.get(1)); 97 | Select state = new Select(driver.findElementById("StateID")); 98 | state.selectByVisibleText("Tamil Nadu"); 99 | Thread.sleep(2000); 100 | // Actions Builder = new Actions(driver); 101 | // Builder.moveToElement(driver.findElementById("CityID")).click().perform(); 102 | Select city = new Select(driver.findElementById("CityID")); 103 | city.selectByVisibleText("Chennai"); 104 | 105 | // 15) Click Search 106 | driver.findElementByXPath("//button[text()='Search']").click(); 107 | 108 | // 16) Print all the 3 models and their prices 109 | Thread.sleep(3000); 110 | List tableRow = driver.findElementsByXPath("//table[@id='gvshow']//tr"); 111 | for (int i = 2; i < tableRow.size(); i++) { 112 | List tableColumn = tableRow.get(i).findElements(By.tagName("td")); 113 | for (int j = 0; j < tableColumn.size(); j++) { 114 | System.out.println(tableColumn.get(j).getText()); 115 | } 116 | } 117 | 118 | // 17) Close the Browser 119 | driver.quit(); 120 | } 121 | } 122 | 123 | -------------------------------------------------------------------------------- /src/main/java/testCases/Day8PepperFry.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.File; 5 | import java.io.IOException; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import javax.imageio.ImageIO; 9 | 10 | import org.apache.commons.io.FileUtils; 11 | import org.openqa.selenium.Keys; 12 | import org.openqa.selenium.OutputType; 13 | import org.openqa.selenium.Point; 14 | import org.openqa.selenium.WebElement; 15 | import org.openqa.selenium.chrome.ChromeDriver; 16 | import org.openqa.selenium.interactions.Actions; 17 | import org.openqa.selenium.remote.RemoteWebDriver; 18 | import org.testng.Assert; 19 | 20 | public class Day8PepperFry { 21 | 22 | public static void main(String[] args) throws InterruptedException, IOException { 23 | // 1) Go to https://www.pepperfry.com/ 24 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedrivers.exe"); 25 | RemoteWebDriver driver = new ChromeDriver(); 26 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 27 | driver.manage().window().maximize(); 28 | driver.get("https://www.pepperfry.com/"); 29 | 30 | // 2) Mouseover on Furniture and click Office Chairs under Chairs 31 | driver.findElementByXPath("//div[@id=\"reg_login_box\"]//a").click(); 32 | Actions builder = new Actions(driver); 33 | builder.moveToElement(driver.findElementByXPath("//div[@id=\"menu_wrapper\"]//a")).perform(); 34 | driver.findElementByXPath("//a[text()='Office Chairs']").click(); 35 | 36 | // 3) click Executive Chairs 37 | driver.findElementByXPath("(//div[@class='cat-wrap-img'])[2]").click(); 38 | 39 | // 4) Change the minimum Height as 50 in under Dimensions 40 | driver.findElementByXPath("//input[@class='clipFilterDimensionHeightValue']").clear(); 41 | driver.findElementByXPath("//input[@class='clipFilterDimensionHeightValue']").sendKeys("50", Keys.ENTER); 42 | 43 | // 5) Add "Poise Executive Chair in Black Colour" chair to Wishlist 44 | Thread.sleep(2000); 45 | driver.findElementByXPath("(//a[@id='clip_wishlist_'])[1]").click(); 46 | 47 | // 6) Mouseover on Homeware and Click Pressure Cookers under Cookware 48 | builder.moveToElement(driver.findElementByXPath("//a[text()=\"Homeware\"]")).perform(); 49 | driver.findElementByXPath("//a[text()='Pressure Cookers']").click(); 50 | 51 | // 7) Select Prestige as Brand 52 | driver.findElementByXPath("//input[@id=\"brandsnamePrestige\"]/following-sibling::label").click(); 53 | 54 | // 8) Select Capacity as 1-3 Ltr 55 | Thread.sleep(2000); 56 | driver.findElementByXPath("//input[@id=\"capacity_db1_Ltr_-_3_Ltr\"]/following-sibling::label").click(); 57 | 58 | // 9) Add "Nakshatra Cute Metallic Red Aluminium Cooker 2 Ltr" to Wishlist 59 | Thread.sleep(2000); 60 | driver.findElementByXPath( 61 | "(//a[text()='Nakshatra Cute Metallic Red Aluminium Cooker 2 Ltr']/../following::div//a)[2]").click(); 62 | 63 | // 10) Verify the number of items in Wishlist 64 | Thread.sleep(2000); 65 | String count = driver.findElementByXPath("(//span[@class='count_alert'])[2]").getText(); 66 | Assert.assertEquals(count, "2"); 67 | 68 | // 11) Navigate to Wishlist 69 | driver.findElementByXPath("//div[@class='wishlist_bar']/a").click(); 70 | 71 | // 12) Move Pressure Cooker only to Cart from Wishlist 72 | driver.findElementByXPath( 73 | "//a[text()='Nakshatra Cute Metallic Red Aluminium Cooker 2 Ltr By...']/following::div//a/i").click(); 74 | 75 | // 13) Check for the availability for Pincode 600128 76 | driver.findElementByXPath("//input[@class=\"srvc_pin_text\"]").sendKeys("600100"); 77 | driver.findElementByXPath("//a[@class=\"check_available\"]").click(); 78 | 79 | // 14) Click Proceed to Pay Securely 80 | driver.findElementByXPath("//a[text()='Proceed to pay securely ']").click(); 81 | 82 | // 15 Click Proceed to Pay 83 | driver.findElementByXPath("//a[text()='PLACE ORDER']").click(); 84 | 85 | // 16) Capture the screenshot of the item under Order Item 86 | driver.findElementByXPath("//span[text()='ORDER SUMMARY']").click(); 87 | Thread.sleep(2000); 88 | WebElement orderItemElement = driver.findElementByXPath("//li[@id='payment_cart_1676140']"); 89 | File scr = driver.getScreenshotAs(OutputType.FILE); 90 | BufferedImage fullImg = ImageIO.read(scr); 91 | Point point = orderItemElement.getLocation(); 92 | 93 | int eleWidth = orderItemElement.getSize().getWidth(); 94 | int eleHeight = orderItemElement.getSize().getHeight(); 95 | 96 | BufferedImage eleScreenshot = fullImg.getSubimage(point.getX(), point.getY(), eleWidth, eleHeight); 97 | ImageIO.write(eleScreenshot, "png", scr); 98 | 99 | File screenshotLocation = new File("./screenshots/screenshot.png"); 100 | FileUtils.copyFile(scr, screenshotLocation); 101 | 102 | // 17) Close the browse 103 | driver.quit(); 104 | } 105 | 106 | } 107 | 108 | -------------------------------------------------------------------------------- /src/main/java/testCases/HondaTwoWheeler.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.LinkedHashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.Map.Entry; 9 | import java.util.Set; 10 | import java.util.concurrent.TimeUnit; 11 | 12 | import org.openqa.selenium.WebElement; 13 | import org.openqa.selenium.chrome.ChromeDriver; 14 | import org.openqa.selenium.firefox.FirefoxDriver; 15 | import org.openqa.selenium.ie.InternetExplorerDriver; 16 | import org.openqa.selenium.interactions.Actions; 17 | import org.openqa.selenium.remote.RemoteWebDriver; 18 | import org.openqa.selenium.support.ui.ExpectedCondition; 19 | import org.openqa.selenium.support.ui.ExpectedConditions; 20 | import org.openqa.selenium.support.ui.Select; 21 | import org.openqa.selenium.support.ui.WebDriverWait; 22 | import org.testng.Assert; 23 | 24 | public class HondaTwoWheeler { 25 | 26 | static RemoteWebDriver driver; 27 | 28 | public static void setBrowser(String browserName) { 29 | if (browserName.equals("chrome")) { 30 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 31 | driver = new ChromeDriver(); 32 | } else if (browserName.equals("fireFox")) { 33 | System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver_64 bit.exe"); 34 | driver = new FirefoxDriver(); 35 | }else if(browserName.equals("IE")) { 36 | System.setProperty("webdriver.ie.driver", "./drivers/IEDriverServer.exe"); 37 | driver = new InternetExplorerDriver(); 38 | } 39 | } 40 | 41 | public static void main(String[] args) throws InterruptedException { 42 | // 1) Go to https://www.honda2wheelersindia.com/ 43 | HondaTwoWheeler.setBrowser("IE"); 44 | driver.manage().window().maximize(); 45 | driver.get("https://www.honda2wheelersindia.com/"); 46 | driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); 47 | driver.findElementByClassName("close").click(); 48 | 49 | // 2) Click on scooters and click dio 50 | driver.findElementByLinkText("Scooter").click(); 51 | driver.findElementByXPath("//div[@id='scooter']//div[@class='item']").click(); 52 | 53 | // 3) Click on Specifications and mouseover on Engine 54 | driver.findElementByLinkText("Specifications").click(); 55 | WebDriverWait wait = new WebDriverWait(driver, 20); 56 | wait.until(ExpectedConditions 57 | .refreshed(ExpectedConditions.elementToBeClickable(driver.findElementByLinkText("ENGINE")))); 58 | 59 | Actions builder = new Actions(driver); 60 | // Thread.sleep(3000); 61 | builder.moveToElement(driver.findElementByLinkText("ENGINE")).perform(); 62 | 63 | // 4) Put all the details as key and value into Map 64 | List dioEngineSpecList = driver.findElementsByXPath("(//ul[@class='tab_content'])[2]/li/span"); 65 | 66 | System.out.println(dioEngineSpecList.get(0).getText()); 67 | Map dioEngineKeyValue = new LinkedHashMap(); 68 | 69 | for (int i = 0; i < dioEngineSpecList.size() - 2; i = i + 2) { 70 | dioEngineKeyValue.put(dioEngineSpecList.get(i + 1).getText(), dioEngineSpecList.get(i + 2).getText()); 71 | } 72 | System.out.println(dioEngineKeyValue); 73 | 74 | // 5) Go to Scooters and click Activa 125 75 | driver.findElementByLinkText("Scooter").click(); 76 | driver.findElementByXPath("(//div[@id='scooter']//div[@class='item'])[3]").click(); 77 | driver.findElementByLinkText("Specifications").click(); 78 | // Actions builder = new Actions(driver); 79 | // Thread.sleep(3000); 80 | wait.until(ExpectedConditions 81 | .refreshed(ExpectedConditions.elementToBeClickable(driver.findElementByLinkText("ENGINE")))); 82 | builder.moveToElement(driver.findElementByLinkText("ENGINE")).perform(); 83 | 84 | // 6) Put All its Engine Specification into another Map same as like dio 85 | List activaEngineSpecList = driver.findElementsByXPath("(//ul[@class='tab_content'])[2]/li/span"); 86 | Map activaEngineKeyValue = new LinkedHashMap(); 87 | 88 | for (int i = 0; i < activaEngineSpecList.size() - 2; i = i + 2) { 89 | activaEngineKeyValue.put(activaEngineSpecList.get(i + 1).getText(), 90 | activaEngineSpecList.get(i + 2).getText()); 91 | } 92 | System.out.println(activaEngineKeyValue); 93 | 94 | // 7) Compare Dio and Activa Maps and print the different values of the samekeys. 95 | Map a1 = new LinkedHashMap(); 96 | Iterator> iter1 = dioEngineKeyValue.entrySet().iterator(); 97 | Iterator> iter2 = activaEngineKeyValue.entrySet().iterator(); 98 | while (iter1.hasNext()) { 99 | Entry entry1 = iter1.next(); 100 | Entry entry2 = iter2.next(); 101 | if (!entry1.getValue().equalsIgnoreCase(entry2.getValue())) { 102 | a1.put(entry1.getValue(), entry2.getValue()); 103 | } 104 | } 105 | System.out.println(a1); 106 | 107 | // 9) Click FAQ from Menu and Click dio under Browse By Product 108 | driver.findElementByLinkText("FAQ").click(); 109 | driver.findElementByPartialLinkText("Dio").click(); 110 | 111 | // 10) Click Vehicle Price and Select scooter, Dio BS-VI from the dropdown and click submit 112 | driver.findElementByPartialLinkText("Vehicle Price").click(); 113 | driver.findElementById("submit6").click(); 114 | 115 | // 11) click the price link, Go to the new Window and select the state, city 116 | driver.findElementByPartialLinkText("Click here to know").click(); 117 | Thread.sleep(10000); 118 | // wait.until(ExpectedConditions.numberOfWindowsToBe(1)); 119 | Set windowHandles = driver.getWindowHandles(); 120 | List orderedWindowHandles = new ArrayList(windowHandles); 121 | driver.switchTo().window(orderedWindowHandles.get(1)); 122 | Select state = new Select(driver.findElementById("StateID")); 123 | state.selectByValue("28"); 124 | 125 | Select city = new Select(driver.findElementById("CityID")); 126 | city.selectByValue("1524"); 127 | 128 | driver.findElementByXPath("//button[text()='Search']").click(); 129 | 130 | // 12) Print the price and model 131 | List modelAndPrice = driver.findElementsByXPath("//table[@id='gvshow']//tbody//td"); 132 | for (int i = 1; i < modelAndPrice.size(); i++) { 133 | System.out.println(modelAndPrice.get(i).getText()); 134 | } 135 | 136 | // 13) Click Product Enquiry and Fill all the * field except Mobile, check the terms and conditions box and click submit 137 | 138 | driver.findElementByPartialLinkText("Product Enquiry").click(); 139 | Select modelID = new Select(driver.findElementById("ModelID")); 140 | modelID.selectByValue("3"); 141 | 142 | Select stateId = new Select(driver.findElementById("StateID")); 143 | stateId.selectByValue("28"); 144 | 145 | Select cityId = new Select(driver.findElementById("CityID")); 146 | cityId.selectByValue("1524"); 147 | 148 | Select titleId = new Select(driver.findElementById("TitleID")); 149 | titleId.selectByValue("Mr."); 150 | 151 | driver.findElementById("Name").sendKeys("Sanjay"); 152 | 153 | driver.findElementById("Email").sendKeys("msankrish92@gmail.com"); 154 | 155 | driver.findElementById("TermsAndConditions").click(); 156 | 157 | driver.findElementById("submit").click(); 158 | 159 | String text = driver.findElementByXPath("//span[@class='text-danger field-validation-error']/span").getText(); 160 | System.out.println(text); 161 | 162 | // 14) Verify the error message under the mobile number field. 163 | Assert.assertEquals(text, "Please enter mobile no."); 164 | 165 | // 15) Close the Browser 166 | driver.quit(); 167 | 168 | } 169 | 170 | } 171 | 172 | -------------------------------------------------------------------------------- /src/main/java/testCases/Inbuild.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.WebDriver; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.chrome.ChromeDriverService; 8 | import org.openqa.selenium.chrome.ChromeOptions; 9 | import org.openqa.selenium.remote.DesiredCapabilities; 10 | import org.openqa.selenium.remote.RemoteWebDriver; 11 | 12 | public class Inbuild { 13 | 14 | public static void main(String[] args) { 15 | // WebDriver driver; 16 | // System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 17 | // ChromeOptions opt = new ChromeOptions(); 18 | //// opt.setBinary("C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 19 | //// ChromeDriverService chromeservices = new ChromeDriverService.Builder().build(); 20 | //// driver = new ChromeDriver(chromeservices, opt); 21 | // DesiredCapabilities capabilities = new DesiredCapabilities(); 22 | // String remotedebug = "localhost:9222"; 23 | // opt.setExperimentalOption("debuggerAddress", remotedebug); 24 | // capabilities.setCapability(ChromeOptions.CAPABILITY, opt); 25 | // driver = new ChromeDriver(capabilities); 26 | //// capabilities.setBrowserName("chrome"); 27 | //// 28 | //// = new ChromeDriver(capabilities); 29 | 30 | System.setProperty("webdriver.chrome.driver","./drivers/chromedriver-v8.2.2-win32-x64/chromedriver.exe"); 31 | ChromeOptions options = new ChromeOptions(); 32 | options.setBinary("C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 33 | options.addArguments("remote-debugging-port=12346"); 34 | //used to run the Electron app in http://localhost:12345/ in browser to inspect elements 35 | DesiredCapabilities capabilities = new DesiredCapabilities(); 36 | capabilities.setCapability("chromeOptions", options); 37 | RemoteWebDriver driver = null; 38 | 39 | driver = new ChromeDriver(options); 40 | 41 | 42 | 43 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 44 | driver.findElementByXPath("//div[@class=\"btn btn-primary\"]").click(); 45 | 46 | /////////////////////////////////////////////// 47 | // System.setProperty("webdriver.chrome.driver","C:\\Users\\hp\\Desktop\\Selenium Learnings\\chromedriver-v8.2.3-win32-ia32\\chromedriver.exe"); 48 | // WebDriver driver = null; 49 | // ChromeOptions opt = new ChromeOptions(); 50 | // opt.setBinary("C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 51 | // DesiredCapabilities capabilities = new DesiredCapabilities(); 52 | // capabilities.setCapability("chromeOptions", opt); 53 | // capabilities.setBrowserName("chrome"); 54 | // driver = new ChromeDriver(capabilities); 55 | 56 | /////////////////////////////////////////////////////// 57 | // ChromeOptions opt = new ChromeOptions(); 58 | // //Enter the path of your Electron app 59 | // opt.setBinary("C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 60 | // System.setProperty("webdriver.chrome.driver","C:\\Users\\hp\\Desktop\\Selenium Learnings\\chromedriver-v8.2.3-win32-ia32\\chromedriver.exe"); 61 | // WebDriver driver = new ChromeDriver(opt); 62 | // driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/testCases/JustDail.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | public class JustDail { 4 | 5 | public static void main(String[] args) { 6 | // 1) https://www.justdial.com/ 7 | // 2) Cick on Air Tickets 8 | // 3) Type Chennai and choose Chennai, IN - Chennai Airport (MAA) as Leaving From 9 | // 4) Type Toronto and select Toronto, CA - Toronto City Centre Airport (YTZ) as Going To 10 | // 5) Set Departure as 2020, July 22 11 | // 6) Add Adult 2, Children 1 click and Search 12 | // 7) Select Air Canada from multi-airline itineraries 13 | // 8) Click on Price to sort the result 14 | // 9) Click on +Details of first result under Price 15 | // 10) Capture the Flight Arrival times. 16 | // 12) Capture the total price in a list and Click on Book 17 | // 13)Capture the Airport name base on the list of time 18 | // 14) Captur the total fare and print the difference amount from previous total price 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/testCases/LensKart.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.JavascriptExecutor; 6 | import org.openqa.selenium.interactions.Actions; 7 | import org.openqa.selenium.support.ui.Select; 8 | 9 | import cucumber.api.java.en.Given; 10 | import cucumber.api.java.en.Then; 11 | import cucumber.api.java.en.When; 12 | import runner.Runner; 13 | 14 | public class LensKart extends Runner { 15 | 16 | static Actions builder; 17 | @Given("the user opens the browser and loads the given url") 18 | public void the_user_opens_the_browser_and_loads_the_given_url() { 19 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 20 | driver.manage().window().maximize(); 21 | driver.get("https://www.lenskart.com/"); 22 | } 23 | 24 | @Given("the user Mouseover on Contact Lenses") 25 | public void the_user_Mouseover_on_Contact_Lenses() { 26 | builder = new Actions(driver); 27 | builder.moveToElement(driver.findElementByLinkText("Contact Lenses")).perform(); 28 | } 29 | 30 | @Given("the user Click on Monthly under Explore By Disposability") 31 | public void the_user_Click_on_Monthly_under_Explore_By_Disposability() { 32 | driver.findElementByLinkText("Monthly").click(); 33 | } 34 | 35 | @Given("the user Select brand as Aqualens") 36 | public void the_user_Select_brand_as_Aqualens() { 37 | driver.findElementByXPath("(//span[contains(text(),\"Aqualens\")])[2]").click(); 38 | } 39 | 40 | @Given("the user Click on the first product") 41 | public void the_user_Click_on_the_first_product() { 42 | driver.findElementByXPath("//div[contains(@class,\"pos-rel\")]").click(); 43 | } 44 | 45 | @Given("the user Click Buy Now") 46 | public void the_user_Click_Buy_Now() { 47 | builder.moveToElement(driver.findElementByXPath("//div[@class='nav-level-1 try-at-home']")).perform(); 48 | builder.moveToElement(driver.findElementByXPath("//button[text()='BUY NOW']")).perform(); 49 | driver.findElementByXPath("//button[text()='BUY NOW']").click(); 50 | } 51 | 52 | @Given("the user Select No of boxes as {int} and Power as {int} for both eyes.") 53 | public void the_user_Select_No_of_boxes_as_and_Power_as_for_both_eyes(int int1, int int2) { 54 | Select box = new Select(driver.findElementByName("boxes")); 55 | box.selectByValue(int1 + ""); 56 | driver.findElementByXPath("//span[text()='Please Select']").click();; 57 | 58 | } 59 | 60 | @Given("the user Type your name in User's name") 61 | public void the_user_Type_your_name_in_User_s_name() { 62 | // Write code here that turns the phrase above into concrete actions 63 | throw new cucumber.api.PendingException(); 64 | } 65 | 66 | @When("the user And click Save and continue") 67 | public void the_user_And_click_Save_and_continue() { 68 | // Write code here that turns the phrase above into concrete actions 69 | throw new cucumber.api.PendingException(); 70 | } 71 | 72 | @Then("the user Print total amount and click Proceed to Checkout") 73 | public void the_user_Print_total_amount_and_click_Proceed_to_Checkout() { 74 | // Write code here that turns the phrase above into concrete actions 75 | throw new cucumber.api.PendingException(); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/testCases/Naukri.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Set; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import org.openqa.selenium.WebElement; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.chrome.ChromeOptions; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | 13 | import cucumber.api.java.en.Given; 14 | import cucumber.api.java.en.Then; 15 | import cucumber.api.java.en.When; 16 | import runner.Runner; 17 | 18 | public class Naukri extends Runner { 19 | 20 | @Given("the user load naukri url") 21 | public void the_user_load_naukri_url() { 22 | 23 | driver.get("https://www.naukri.com/"); 24 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 25 | driver.manage().window().maximize(); 26 | } 27 | 28 | static public Set windowHandles; 29 | static List orderedWindow; 30 | @Given("the user goes the first opened window and get the company Name") 31 | public void the_user_goes_the_first_opened_window_and_get_the_company_Name() { 32 | windowHandles = driver.getWindowHandles(); 33 | orderedWindow = new ArrayList<>(windowHandles); 34 | System.out.println(orderedWindow); 35 | driver.switchTo().window(orderedWindow.get(1)); 36 | driver.manage().window().maximize(); 37 | String firstCompany = driver.findElementByXPath("//body/a/img").getAttribute("alt"); 38 | System.out.println(firstCompany); 39 | driver.close(); 40 | 41 | 42 | } 43 | 44 | // @Given("the user closes that window") 45 | // public void the_user_closes_that_window() { 46 | // driver.switchTo().window(orderedWindow.get(2)); 47 | // driver.manage().window().maximize(); 48 | // String secondCompany = driver.findElementByXPath("//body/a/img").getAttribute("alt"); 49 | // System.out.println(secondCompany); 50 | // driver.close(); 51 | //// Thread.sleep(500); 52 | // driver.switchTo().window(orderedWindow.get(0));driver.findElementById("block").click(); 53 | // } 54 | 55 | @Given("the user goes the second opened window and get the company Name") 56 | public void the_user_goes_the_second_opened_window_and_get_the_company_Name() { 57 | } 58 | 59 | @When("the user uploads unsupported file as CV") 60 | public void the_user_uploads_unsupported_file_as_CV() { 61 | WebElement findElementById = driver.findElementById("file_upload"); 62 | // findElementById.click(); 63 | findElementById.sendKeys("C:\\Users\\hp\\Downloads\\317820-Mike-Tyson-Quote-Discipline-is-doing-what-you-hate-to-do-but.jpg"); 64 | 65 | System.out.println(driver.findElementByXPath("//div[@class='error-header-desc error']").getText()); 66 | 67 | } 68 | 69 | @Then("the user validates the error message") 70 | public void the_user_validates_the_error_message() { 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/testCases/RedBus.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.firefox.FirefoxDriver; 6 | import org.openqa.selenium.firefox.FirefoxOptions; 7 | import org.openqa.selenium.remote.RemoteWebDriver; 8 | import org.openqa.selenium.support.ui.ExpectedConditions; 9 | import org.openqa.selenium.support.ui.WebDriverWait; 10 | 11 | public class RedBus { 12 | 13 | public static void main(String[] args) { 14 | // 1. Launch URL: https://www.redbus.in/ 15 | System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver_64 bit.exe"); 16 | 17 | FirefoxOptions opt = new FirefoxOptions(); 18 | opt.addPreference("dom.webnotifications.enabled", false); 19 | 20 | RemoteWebDriver driver = new FirefoxDriver(opt); 21 | driver.get("https://www.redbus.in/"); 22 | WebDriverWait wait = new WebDriverWait(driver, 15); 23 | 24 | // 2. Enter 'from' place as 'Chennai' 25 | driver.findElementById("src").sendKeys("Chennai"); 26 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("selected"))); 27 | driver.findElementByClassName("selected").click(); 28 | 29 | // 3. Enter 'to' place as 'Bangalore' 30 | driver.findElementById("dest").sendKeys("Bangalore"); 31 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("selected"))); 32 | driver.findElementByClassName("selected").click(); 33 | 34 | 35 | // 4. Pick onward date as today 36 | driver.findElementByXPath("//td[@class='current day']").click(); 37 | 38 | // 5. Click on 'Search Buses' 39 | driver.findElementById("search_btn").click(); 40 | 41 | // 6. Check 'After 6 pm' under 'DEPARTURE TIME' 42 | // 7. Check 'Sleeper' under 'BUS TYPE' 43 | // 8. Click on 'Seats Available' to sort 44 | // 9. Get the number of seats available in the (extract the # alone) first result 45 | // 10. Click on 'VIEW SEATS' 46 | // 11. Take a screenshot of the Seat Map for the highest seats available bus 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/testCases/Shein.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.time.Duration; 4 | 5 | import org.openqa.selenium.By; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.chrome.ChromeOptions; 8 | import org.openqa.selenium.interactions.Actions; 9 | import org.openqa.selenium.remote.RemoteWebDriver; 10 | import org.openqa.selenium.support.ui.ExpectedConditions; 11 | import org.openqa.selenium.support.ui.WebDriverWait; 12 | import org.w3c.dom.html.HTMLUListElement; 13 | 14 | public class Shein { 15 | 16 | public static void main(String[] args) throws InterruptedException { 17 | 18 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 19 | ChromeOptions options = new ChromeOptions(); 20 | options.addArguments("--disable-notifications"); 21 | RemoteWebDriver driver = new ChromeDriver(options); 22 | 23 | 24 | // 1) open https://www.shein.in/ 25 | driver.get("https://www.shein.in/"); 26 | driver.manage().window().maximize(); 27 | driver.findElementByXPath("//i[@class='iconfont icon-arrow-left']").click(); 28 | 29 | // 2) Mouseover on Clothing and click Jeans 30 | driver.findElementByName("header-search").click(); 31 | WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(10)); 32 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@title='jeans']"))); 33 | driver.findElementByXPath("//a[@title='jeans']").click(); 34 | 35 | // 3) Choose Black under Jeans product count 36 | driver.findElementByXPath("//span[text()='Color']").click(); 37 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[text()='Black']/following-sibling::i"))); 38 | driver.findElementByXPath("//span[text()='Black']/following-sibling::i").click(); 39 | 40 | // 4) check size as medium 41 | driver.findElementByXPath("(//span[@class='attr-check-box'])[3]").click(); 42 | 43 | // 5) Click + in color 44 | String color = driver.findElementByXPath("//span[text()='Black']").getCssValue("color"); 45 | System.out.println(color); 46 | // 6) check whether the color is black 47 | // 7) Click first item to Add to Bag 48 | // Thread.sleep(5000); 49 | Actions builder = new Actions(driver); 50 | builder.moveToElement(driver.findElementByXPath("(//div[@class='c-goodsitem__ratiowrap']//img)[1]")).perform(); 51 | builder.moveToElement(driver.findElementByXPath("//button[contains(text(),'Add to Bag')]")).click().perform(); 52 | // 8) Click the size as M abd click Submit 53 | // Thread.sleep(5000); 54 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("(//span[contains(@class,'opt-real')])[2]"))); 55 | driver.findElementByXPath("(//span[contains(@class,'opt-real')])[2]").click(); 56 | driver.findElementByXPath("(//button[contains(text(),'Submit')])[1]").click(); 57 | // 9) Click view Bag 58 | builder.moveToElement(driver.findElementByXPath("(//i[contains(@class,'iconfont-critical')])[2]")).perform(); 59 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[text()='view bag']"))); 60 | driver.findElementByXPath("//a[text()='view bag']").click(); 61 | // 10) Check the size is Medium or not. 62 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='gd-size']/em"))); 63 | String size = driver.findElementByXPath("//span[@class='gd-size']/em").getText(); 64 | System.out.println(size); 65 | // 11) Close the browser. 66 | driver.close(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/testCases/ShienWC.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.JavascriptExecutor; 6 | import org.openqa.selenium.chrome.ChromeDriver; 7 | import org.openqa.selenium.chrome.ChromeOptions; 8 | import org.openqa.selenium.interactions.Actions; 9 | import org.openqa.selenium.remote.RemoteWebDriver; 10 | import org.testng.Assert; 11 | 12 | public class ShienWC { 13 | 14 | 15 | public static void main(String[] args) throws InterruptedException { 16 | RemoteWebDriver driver; 17 | ChromeOptions options = new ChromeOptions(); 18 | options.addArguments("--disable-notifications"); 19 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 20 | driver = new ChromeDriver(options); 21 | driver.manage().window().maximize(); 22 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 23 | 24 | driver.get("https://www.shein.in/"); 25 | driver.findElementByXPath("//div[@class='c-coupon-box']/i").click(); 26 | Actions builder = new Actions(driver); 27 | builder.moveToElement(driver.findElementByLinkText("CLOTHING")).perform(); 28 | 29 | builder.moveToElement(driver.findElementByXPath("//a[contains(text(),\"Jeans\")]")).click().build().perform(); 30 | 31 | 32 | driver.findElementByXPath("//a[text()='Black']").click(); 33 | 34 | 35 | driver.findElementByXPath("//span[text()='Size']").click(); 36 | driver.findElementByXPath("(//span[@class='attr-check-box'])[8]").click(); 37 | 38 | String color = driver.findElementByXPath("//span[text()='Color']/../following-sibling::div//a//i").getCssValue("color"); 39 | 40 | Assert.assertEquals(color, "rgba(102, 102, 102, 1)"); 41 | 42 | JavascriptExecutor js = (JavascriptExecutor)driver; 43 | 44 | js.executeScript("window.scrollBy(0,500)"); 45 | Thread.sleep(2000); 46 | builder.moveToElement(driver.findElementByXPath("//div[@class='c-goodsitem__ratiowrap']/a/img")).perform(); 47 | builder.moveToElement(driver.findElementByXPath("//button[contains(text(),'Add to Bag')]")).click().build().perform(); 48 | 49 | 50 | driver.findElementByXPath("(//input[@class='opt']/following-sibling::span)[2]").click(); 51 | driver.findElementByXPath("//button[contains(text(),'Submit')]").click(); 52 | 53 | driver.findElementByXPath("//a[text()='view bag']").click(); 54 | 55 | String size = driver.findElementByXPath("//span[@class='gd-size']/em").getText(); 56 | 57 | Assert.assertEquals(size, "M"); 58 | 59 | // System.out.println(size); 60 | // driver.findElementByXPath("//button[contains(text(),'Add to Bag')]").click(); 61 | 62 | driver.close(); 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/testCases/StudyAbroad.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | import java.util.Comparator; 7 | import java.util.HashMap; 8 | import java.util.LinkedHashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Map.Entry; 12 | import java.util.concurrent.TimeUnit; 13 | import java.util.function.BiConsumer; 14 | import java.util.function.BiFunction; 15 | import java.util.function.BiPredicate; 16 | import java.util.function.Predicate; 17 | import java.util.stream.Collectors; 18 | 19 | import org.openqa.selenium.By; 20 | import org.openqa.selenium.JavascriptExecutor; 21 | import org.openqa.selenium.WebDriver; 22 | import org.openqa.selenium.WebElement; 23 | import org.openqa.selenium.chrome.ChromeDriver; 24 | import org.openqa.selenium.firefox.FirefoxDriver; 25 | import org.openqa.selenium.ie.InternetExplorerDriver; 26 | import org.openqa.selenium.interactions.Actions; 27 | import org.openqa.selenium.remote.RemoteWebDriver; 28 | import org.openqa.selenium.support.ui.ExpectedCondition; 29 | import org.openqa.selenium.support.ui.ExpectedConditions; 30 | import org.openqa.selenium.support.ui.Select; 31 | import org.openqa.selenium.support.ui.WebDriverWait; 32 | 33 | import supportingClass.StudyAbroadHelper; 34 | 35 | public class StudyAbroad { 36 | 37 | public static RemoteWebDriver driver; 38 | 39 | public static void browserSetUp(String browserName) { 40 | if (browserName.equals("chrome")) { 41 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 42 | driver = new ChromeDriver(); 43 | } else if (browserName.equals("firefox")) { 44 | System.setProperty("webdriver.gecko.driver", "./drivers/geckodriver_64 bit.exe"); 45 | driver = new FirefoxDriver(); 46 | } else if (browserName.equals("IE")) { 47 | System.setProperty("webdriver.ie.driver", "./drivers/IEDriverServer.exe"); 48 | driver = new InternetExplorerDriver(); 49 | } 50 | } 51 | 52 | public static void main(String[] args) throws InterruptedException { 53 | // 1) Go to https://studyabroad.shiksha.com/ 54 | 55 | browserSetUp("chrome"); 56 | driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 57 | driver.manage().window().maximize(); 58 | driver.get("https://studyabroad.shiksha.com/"); 59 | 60 | // 2) Mouse over on Colleges and click MS in Computer Science &Engg under MS Colleges 61 | 62 | Actions builder = new Actions(driver); 63 | builder.moveToElement(driver.findElementByXPath("(//label[contains(text(),\"Colleges\")])[2]")).perform(); 64 | Thread.sleep(5000); 65 | driver.findElementByXPath("//a[text()=\"MS in Computer Science &Engg\"]").click(); 66 | 67 | // 3) Click Change course / country select box, choose course as BE/Btech and Choose specialization as Computer Science & Engineering 68 | 69 | WebDriverWait wait = new WebDriverWait(driver, 15); 70 | wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("categoryPagePushDownBannerFrame"))); 71 | wait.until(ExpectedConditions.elementToBeClickable(By.id("Stage_Rectangle2"))); 72 | driver.switchTo().defaultContent(); 73 | driver.findElementByXPath("//a[text()=' Change course / country ']").click(); 74 | Select desiredCourse = new Select(driver.findElementByName("desiredCourse")); 75 | desiredCourse.selectByValue("1510"); 76 | wait.until(ExpectedConditions.elementToBeClickable(By.name("subCatSelect"))); 77 | Select subCat = new Select(driver.findElementByName("subCatSelect")); 78 | subCat.selectByValue("277"); 79 | 80 | // 4) Select Study destination as USA, UK, Canada and click Update 81 | 82 | Thread.sleep(5000); 83 | driver.findElementByClassName("select-overlap").click(); 84 | WebElement flag = driver.findElementByXPath("//input[@id='0-flag']/.."); 85 | flag.click(); 86 | driver.findElementByXPath("//input[@id='1-flag']/..").click(); 87 | driver.findElementByXPath("//input[@id='5-flag']/..").click(); 88 | driver.findElementByXPath("//a[text()='OK']").click(); 89 | driver.findElementByXPath("//div[@id='courseCountryLayer_error']/following::input").click(); 90 | 91 | // 5) In Filters Select IELTS and score as 7.5 & Below in Exam Accepted 92 | for (int i = 0; i < 3; i++) { 93 | try { 94 | driver.findElementByXPath("//p[text()='IELTS']//preceding-sibling::span").click(); 95 | break; 96 | } catch (Exception e) { 97 | 98 | } 99 | } 100 | wait.until(ExpectedConditions 101 | .elementToBeClickable(By.xpath("(//div[contains(@class,\"filter-dropdown\")])[2]/select"))); 102 | Select score = new Select(driver.findElementByXPath("(//div[contains(@class,\"filter-dropdown\")])[2]/select")); 103 | score.selectByVisibleText("6.5 & below"); 104 | 105 | // 6) Total Fees as Max 20L 106 | 107 | wait.until(ExpectedConditions.refreshed(ExpectedConditions 108 | .stalenessOf(driver.findElementByXPath("//p[text()='Max 20 Lakhs']//preceding-sibling::span")))); 109 | // wait.until(ExpectedConditions 110 | // .invisibilityOfElementLocated(By.xpath("//p[text()='Max 20 Lakhs']//preceding-sibling::span"))); 111 | // wait.until(ExpectedConditions 112 | // .visibilityOfElementLocated(By.xpath("//p[text()='Max 20 Lakhs']//preceding-sibling::span"))); 113 | driver.findElementByXPath("//p[text()='Max 20 Lakhs']//preceding-sibling::span").click(); 114 | 115 | // 7) Capture the college Names and fees only if it is Engineering course 116 | Thread.sleep(5000); 117 | List courseNameList = driver 118 | .findElementsByXPath("//div[contains(@class,\"course-touple\")]//a[@class='tuple-sub-title']"); 119 | 120 | List collegeNameList = driver.findElementsByXPath("//div[@class='tuple-title']/p[2]/a"); 121 | 122 | List feesList = driver 123 | .findElementsByXPath("//strong[text()=' 1st Year Total Fees']/following-sibling::p"); 124 | 125 | // BiFunction, List, Map> fun = ((coll, fees) -> { 126 | // 127 | // return StudyAbroadHelper.filter(coll, fees); 128 | // }); 129 | 130 | // System.out.println(fun.apply(collegeNameList, feesList)); 131 | 132 | Map collegeListWithFees = new HashMap<>(); 133 | Map courseWithFees = new HashMap<>(); 134 | for (int i = 0; i < courseNameList.size(); i++) { 135 | if (courseNameList.get(i).getText().contains("Engineering")) { 136 | collegeListWithFees.put(collegeNameList.get(i).getText(), feesList.get(i).getText()); 137 | courseWithFees.put(courseNameList.get(i).getText(), feesList.get(i).getText()); 138 | } 139 | } 140 | System.out.println(collegeListWithFees); 141 | 142 | // for (int i = 0; i < collegeNameList.size(); i++) { 143 | // collegeListWithFees.put(collegeNameList.get(i).getText(), feesList.get(i).getText()); 144 | // } 145 | // 146 | // Map output = collegeListWithFees.entrySet().stream() 147 | // .filter(map -> map.getKey().contains("Engineering")) 148 | // .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); 149 | // 150 | // System.out.println(output); 151 | 152 | // 8) Take 20 colleges by Click Next button and go to next page. 153 | for (WebElement a : collegeNameList) { 154 | System.out.println(a.getText()); 155 | } 156 | driver.findElementByXPath("//a[text()='Next']").click(); 157 | 158 | // 9) Search the college name in the search box based on low fees 159 | Map output2 = new LinkedHashMap<>(); 160 | for (Map.Entry a : collegeListWithFees.entrySet()) { 161 | String replaceAll = a.getValue().replaceAll("[^0-9.]", ""); 162 | double fee = Double.parseDouble(replaceAll); 163 | output2.put(a.getValue(), fee); 164 | } 165 | 166 | List> entries = new ArrayList<>(output2.entrySet()); 167 | Collections.sort(entries, new Comparator>() { 168 | 169 | @Override 170 | public int compare(Entry o1, Entry o2) { 171 | // TODO Auto-generated method stub 172 | return o1.getValue().compareTo(o2.getValue()); 173 | } 174 | }); 175 | // System.out.println(temp); 176 | String lowestFee = entries.get(0).getKey(); 177 | System.out.println(lowestFee); 178 | String collegeName = new String(); 179 | for (Map.Entry a : collegeListWithFees.entrySet()) { 180 | if (a.getValue().equals(lowestFee)) { 181 | collegeName = a.getKey(); 182 | } 183 | } 184 | Thread.sleep(5000); 185 | 186 | driver.findElementById("seachTextBox").click(); 187 | driver.findElementById("mainSearchBox").sendKeys(collegeName); 188 | driver.findElementById("searchGoButton").click(); 189 | 190 | // 10) Match the IELTS score, course Title and country from the University Page 191 | driver.findElementByXPath("//label[text()='Courses']").click(); 192 | String coureseName = new String(); 193 | for(Map.Entry a : courseWithFees.entrySet()) { 194 | if(a.getValue().equals(lowestFee)) { 195 | coureseName=a.getKey(); 196 | } 197 | } 198 | 199 | String Itil = driver.findElementByXPath("//a[text()='"+coureseName+"']/following-sibling::div/div/div[3]/p").getText(); 200 | System.out.println(Itil); 201 | 202 | // 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /src/main/java/testCases/Test.java: -------------------------------------------------------------------------------- 1 | //package testCases; 2 | // 3 | //import java.net.MalformedURLException; 4 | //import java.net.URL; 5 | //import java.util.concurrent.TimeUnit; 6 | // 7 | //import org.openqa.selenium.interactions.Actions; 8 | //import org.openqa.selenium.remote.DesiredCapabilities; 9 | // 10 | //import io.appium.java_client.windows.WindowsDriver; 11 | // 12 | //public class Test { 13 | // 14 | // public static void main(String[] args) throws MalformedURLException, InterruptedException { 15 | // 16 | // DesiredCapabilities capabilities = new DesiredCapabilities(); 17 | // capabilities.setCapability("app", "C:\\Users\\hp\\AppData\\Local\\Postman\\Postman.exe"); 18 | //// capabilities.setCapability("deviceName", "windows 10"); 19 | // WindowsDriver driver = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities); 20 | // driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 21 | // Actions builder = new Actions(driver); 22 | // builder.moveByOffset(91, 61).click(); 23 | //// driver.findElementByName("New").click(); 24 | //// driver.findElementByXPath("//div[@class=\"btn btn-primary\"]").click(); 25 | //// Thread.sleep(5000); 26 | //// driver.findElementByName("Collection").click(); 27 | //// Thread.sleep(5000); 28 | //// driver.findElementByName("Collection Name").sendKeys("RestLearning"); 29 | //// Thread.sleep(5000); 30 | //// driver.findElementByName("Create").click(); 31 | // 32 | // } 33 | // 34 | //} 35 | // 36 | -------------------------------------------------------------------------------- /src/main/java/testCases/WindowsAuthentication.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.Base64; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.Optional; 7 | 8 | import org.openqa.selenium.chrome.ChromeDriver; 9 | import org.openqa.selenium.devtools.DevTools; 10 | import org.openqa.selenium.devtools.network.Network; 11 | import org.openqa.selenium.devtools.network.model.Headers; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | 14 | public class WindowsAuthentication { 15 | 16 | public static void main(String[] args) { 17 | 18 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 19 | // RemoteWebDriver driver = new ChromeDriver(); 20 | // driver.manage().window().maximize(); 21 | // driver.get("https://the-internet.herokuapp.com/"); 22 | // driver.findElementByXPath("//a[text()='Basic Auth']").click(); 23 | //// driver.navigate().to("https://admin:admin@the-internet.herokuapp.com/digest_auth"); 24 | // 25 | // 26 | // String username = "admin"; 27 | // String password = "admin"; 28 | //// ChromeDevToolsService devToolsService = DevToolsService.getDevToolsService(driver); 29 | // 30 | // DevTools devTools = driver.getD 31 | // devTools.createSession(); 32 | 33 | // WebDriverManager.chromedriver().setup(); 34 | ChromeDriver driver = new ChromeDriver(); 35 | 36 | String username = "admin"; // authentication username 37 | String password = "admin"; // authentication password 38 | 39 | // Get the devtools from the running driver and create a session 40 | DevTools devTools = driver.getDevTools(); 41 | devTools.createSession(); 42 | 43 | // Enable the Network domain of devtools 44 | devTools.send(Network.enable(Optional.of(100000), Optional.of(100000), Optional.of(100000))); 45 | String auth = username +":"+ password; 46 | 47 | // Encoding the username and password using Base64 (java.util) 48 | String encodeToString = Base64.getEncoder().encodeToString(auth.getBytes()); 49 | 50 | // Pass the network header -> Authorization : Basic 51 | Map headers = new HashMap(); 52 | headers.put("Authorization", "Basic "+encodeToString); 53 | devTools.send(Network.setExtraHTTPHeaders(new Headers(headers))); 54 | 55 | System.out.println(headers); 56 | // Load the url 57 | driver.get("https://the-internet.herokuapp.com/basic_auth"); 58 | 59 | String text = driver.findElementByXPath("//p").getText(); 60 | System.out.println(text); 61 | 62 | 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/testCases/ZoomCar.java: -------------------------------------------------------------------------------- 1 | package testCases; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import java.util.TreeMap; 7 | 8 | import org.openqa.selenium.By; 9 | import org.openqa.selenium.WebElement; 10 | import org.openqa.selenium.chrome.ChromeDriver; 11 | import org.openqa.selenium.remote.RemoteWebDriver; 12 | import org.openqa.selenium.support.ui.ExpectedConditions; 13 | import org.openqa.selenium.support.ui.WebDriverWait; 14 | 15 | public class ZoomCar { 16 | 17 | public static void main(String[] args) throws InterruptedException { 18 | 19 | System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe"); 20 | RemoteWebDriver driver = new ChromeDriver(); 21 | driver.manage().window().maximize(); 22 | 23 | WebDriverWait wait = new WebDriverWait(driver, 15); 24 | 25 | // 1. Launch URL: https://www.zoomcar.com/chennai 26 | driver.get("https://www.zoomcar.com/chennai"); 27 | 28 | // 2. Click on the Start your wonderful journey link 29 | driver.findElementByXPath("//a[@title='Start your wonderful journey']").click(); 30 | 31 | // 3. In the Search page, Click on any pick up point under POPULAR PICK-UP 32 | driver.findElementByXPath("//div[@class='items']").click(); 33 | 34 | // 4. Click on the Next button 35 | driver.findElementByXPath("//button[text()='Next']").click(); 36 | 37 | // 5. Specify the Start Date as tomorrow Date 38 | // Thread.sleep(5000); 39 | wait.until(ExpectedConditions.visibilityOfElementLocated( 40 | By.xpath("//div[contains(@class,'day picked')]/following-sibling::div[1]"))); 41 | String startDate = driver.findElementByXPath("//div[contains(@class,'day picked')]/following-sibling::div[1]") 42 | .getText().replaceAll("[\\D]", ""); 43 | System.out.println(startDate); 44 | driver.findElementByXPath("//div[contains(@class,'day picked')]/following-sibling::div[1]").click(); 45 | 46 | // 6. Click on the Next Button 47 | driver.findElementByXPath("//button[text()='Next']").click(); 48 | 49 | // 7. Confirm the Start Date and Click on the Done button 50 | driver.findElementByXPath("//button[text()='Done']").click(); 51 | 52 | // 8. In the result page, capture the number of results displayed. 53 | wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='car-listing']"))); 54 | int noOfResultsDisplayed = driver.findElementsByXPath("//div[@class='car-listing']").size(); 55 | System.out.println(noOfResultsDisplayed); 56 | 57 | // 9. Find the highest priced car ride. 58 | 59 | List priceList = driver.findElementsByXPath("//div[@class='price']"); 60 | Map act = new TreeMap<>(); 61 | priceList.stream().forEach(ele -> act.put(Integer.parseInt(ele.getText().replaceAll("[^0-9]", "")), 62 | ele.getText().replaceAll("[^0-9,]", ""))); 63 | int max = act.entrySet().stream().map(ele -> ele.getKey()).max(Integer::compare).get(); 64 | System.out.println(act.get(max)); 65 | 66 | // List intPriceList = priceList.stream().map(ele -> Integer.parseInt(ele.getText().replaceAll("[^0-9]", ""))).collect(Collectors.toList()); 67 | // System.out.println(intPriceList); 68 | // Optional max = intPriceList.stream().max(Integer::compare); 69 | // System.out.println(max.get()); 70 | // 10. Click on the Book Now button for it. 71 | driver.findElementByXPath("//div[contains(text(),'" + act.get(max) + "')]/following-sibling::button").click(); 72 | 73 | // 11. Close the Browser. 74 | driver.quit(); 75 | 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /test-output/Default suite/Default test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestNG: Default test 4 | 5 | 6 | 7 | 11 | 53 | 54 | 55 | 56 |

Default test

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Tests passed/Failed/Skipped:0/1/0
Started on:Tue Jun 30 01:24:10 IST 2020
Total time:14 seconds (14933 ms)
Included groups:
Excluded groups:

69 | (Hover the method name to see the test class name)

70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 123 | 124 | 125 |
FAILED TESTS
Test methodExceptionTime (seconds)Instance
runScenario
Test class: testCases.Shein
Test method: Runs Cucumber Scenarios
Parameters: "TC_001", "Shein"
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a style="color: #000;" title="Jeans" class="" href="https://www.shein.in/Jeans-c-1934.html?icn=jeans&amp;ici=in_tab01navbar02menu11dir01&amp;srctype=category&amp;userpath=category>WOMEN>CLOTHING>Denim>Jeans&amp;scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">...</a> is not clickable at point (15, 7). Other element would receive the click: <div class="config-wrap j-topbanner-fixer" style="background: url(&quot;//img.ltwebstatic.com/images3_acp/2020/06/25/15930711117f7cfdf0aaa3acab72192ca364854a0f.gif&quot;) center 0px / 1920px 48px transparent; transform: translateY(0px);">...</div>
 80 |   (Session info: chrome=83.0.4103.116)
 81 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
 82 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
 83 | Driver info: org.openqa.selenium.chrome.ChromeDriver
 84 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
 85 | Session ID: 7db458f322cfc46e79a9db0161225d2e
 86 | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 87 | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 88 | 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 89 | 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 90 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
 91 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
 92 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
 93 | 	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
 94 | 	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
 95 | 	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
 96 | 	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
 97 | 	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
 98 | 	at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22)
 99 | 	at ?.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6)
100 | 
Click to show all stack frames 101 |
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a style="color: #000;" title="Jeans" class="" href="https://www.shein.in/Jeans-c-1934.html?icn=jeans&amp;ici=in_tab01navbar02menu11dir01&amp;srctype=category&amp;userpath=category>WOMEN>CLOTHING>Denim>Jeans&amp;scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">...</a> is not clickable at point (15, 7). Other element would receive the click: <div class="config-wrap j-topbanner-fixer" style="background: url(&quot;//img.ltwebstatic.com/images3_acp/2020/06/25/15930711117f7cfdf0aaa3acab72192ca364854a0f.gif&quot;) center 0px / 1920px 48px transparent; transform: translateY(0px);">...</div>
102 |   (Session info: chrome=83.0.4103.116)
103 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
104 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
105 | Driver info: org.openqa.selenium.chrome.ChromeDriver
106 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
107 | Session ID: 7db458f322cfc46e79a9db0161225d2e
108 | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
109 | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
110 | 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
111 | 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
112 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
113 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
114 | 	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
115 | 	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
116 | 	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
117 | 	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
118 | 	at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
119 | 	at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
120 | 	at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22)
121 | 	at ?.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6)
122 | 
14testCases.Shein@76f2b07d

126 | 127 | -------------------------------------------------------------------------------- /test-output/Default suite/Default test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | WOMEN>CLOTHING>Denim>Jeans&scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">... is not clickable at point (15, 7). Other element would receive the click:

...
13 | (Session info: chrome=83.0.4103.116) 14 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 15 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 16 | Driver info: org.openqa.selenium.chrome.ChromeDriver 17 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 18 | Session ID: 7db458f322cfc46e79a9db0161225d2e 19 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 20 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 21 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 22 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 23 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 24 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 25 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 26 | at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) 27 | at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 28 | at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) 29 | at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) 30 | at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 31 | at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22) 32 | at ✽.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6) 33 | ]]> 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /test-output/Default suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test-output/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/bullet_point.png -------------------------------------------------------------------------------- /test-output/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/collapseall.gif -------------------------------------------------------------------------------- /test-output/emailable-report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestNG Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Test# Passed# Skipped# Retried# FailedTime (ms)Included GroupsExcluded Groups
Default suite
Default test000114,933
14 | 15 |
ClassMethodStartTime (ms)
Default suite
Default test — failed
testCases.SheinrunScenario159346045090714387
16 |

Default test

testCases.Shein#runScenario

Parameter #1Parameter #2
"TC_001""Shein"
Exception
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a style="color: #000;" title="Jeans" class="" href="https://www.shein.in/Jeans-c-1934.html?icn=jeans&amp;ici=in_tab01navbar02menu11dir01&amp;srctype=category&amp;userpath=category>WOMEN>CLOTHING>Denim>Jeans&amp;scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">...</a> is not clickable at point (15, 7). Other element would receive the click: <div class="config-wrap j-topbanner-fixer" style="background: url(&quot;//img.ltwebstatic.com/images3_acp/2020/06/25/15930711117f7cfdf0aaa3acab72192ca364854a0f.gif&quot;) center 0px / 1920px 48px transparent; transform: translateY(0px);">...</div> 17 | (Session info: chrome=83.0.4103.116) 18 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 19 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 20 | Driver info: org.openqa.selenium.chrome.ChromeDriver 21 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 22 | Session ID: 7db458f322cfc46e79a9db0161225d2e 23 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 24 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 25 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 26 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 27 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 28 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 29 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 30 | at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) 31 | at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 32 | at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) 33 | at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) 34 | at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 35 | at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22) 36 | at ✽.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6) 37 |

back to summary

38 | 39 | 40 | -------------------------------------------------------------------------------- /test-output/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/failed.png -------------------------------------------------------------------------------- /test-output/junitreports/TEST-runner.Runner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | WOMEN>CLOTHING>Denim>Jeans&scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">... is not clickable at point (15, 7). Other element would receive the click:
...
13 | (Session info: chrome=83.0.4103.116) 14 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 15 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 16 | Driver info: org.openqa.selenium.chrome.ChromeDriver 17 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60642}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 18 | Session ID: a2e5013fffc812b0a857a82ac8515425 19 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 20 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 21 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 22 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 23 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 24 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 25 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 26 | at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) 27 | at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 28 | at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) 29 | at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) 30 | at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 31 | at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:21) 32 | at ✽.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6) 33 | ]]> 34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /test-output/junitreports/TEST-testCases.LensKart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test-output/junitreports/TEST-testCases.Shein.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | WOMEN>CLOTHING>Denim>Jeans&scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">... is not clickable at point (15, 7). Other element would receive the click:
...
13 | (Session info: chrome=83.0.4103.116) 14 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 15 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 16 | Driver info: org.openqa.selenium.chrome.ChromeDriver 17 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 18 | Session ID: 7db458f322cfc46e79a9db0161225d2e 19 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 20 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 21 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 22 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 23 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 24 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 25 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 26 | at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) 27 | at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 28 | at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) 29 | at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) 30 | at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 31 | at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22) 32 | at ✽.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6) 33 | ]]> 34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /test-output/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/navigator-bullet.png -------------------------------------------------------------------------------- /test-output/old/Default suite/Default test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=Default test] -------------------------------------------------------------------------------- /test-output/old/Default suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
Class nameMethod nameGroups
testCases.Shein  
@Test
 runScenariocucumber
@BeforeClass
 setUpClass 
@BeforeMethod
@AfterMethod
@AfterClass
 tearDownClass 
38 | -------------------------------------------------------------------------------- /test-output/old/Default suite/groups.html: -------------------------------------------------------------------------------- 1 |

Groups used for this test run

2 | 3 |
Group nameMethods
cucumberAbstractTestNGCucumberTests.runScenario(cucumber.api.testng.PickleEventWrapper, cucumber.api.testng.CucumberFeatureWrapper)[pri:0, instance:testCases.Shein@76f2b07d]
4 | -------------------------------------------------------------------------------- /test-output/old/Default suite/index.html: -------------------------------------------------------------------------------- 1 | Results for Default suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test-output/old/Default suite/main.html: -------------------------------------------------------------------------------- 1 | Results for Default suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /test-output/old/Default suite/methods-alphabetical.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Default suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
20/06/30 01:24:01 0 >>browserSetUp      main@1253946629
20/06/30 01:24:10 9648      runScenariomain@1253946629
20/06/30 01:24:10 9172   >>setUpClass    main@1253946629
20/06/30 01:24:25 24056   <<tearDownClass    main@1253946629
13 | -------------------------------------------------------------------------------- /test-output/old/Default suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 |

Methods that were not run

2 |
-------------------------------------------------------------------------------- /test-output/old/Default suite/methods.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Default suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
20/06/30 01:24:01 0 >>browserSetUp      main@1253946629
20/06/30 01:24:10 9172   >>setUpClass    main@1253946629
20/06/30 01:24:10 9648      runScenariomain@1253946629
20/06/30 01:24:25 24056   <<tearDownClass    main@1253946629
13 | -------------------------------------------------------------------------------- /test-output/old/Default suite/reporter-output.html: -------------------------------------------------------------------------------- 1 |

Reporter output

-------------------------------------------------------------------------------- /test-output/old/Default suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for Default suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Default suite">
  <test thread-count="5" verbose="2" name="Default test">
    <classes>
      <class name="testCases.Shein"/>
    </classes>
  </test> <!-- Default test -->
</suite> <!-- Default suite -->
-------------------------------------------------------------------------------- /test-output/old/Default suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for Default suite 4 | 5 | 6 | 7 | 8 |

Results for
Default suite

9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 |
1 test1 class1 method:
14 |   chronological
15 |   alphabetical
16 |   not run (0)
1 groupreporter outputtestng.xml
23 | 24 |

29 |

25 |
Default test (0/1/0) 26 | Results 27 |
28 |
30 | -------------------------------------------------------------------------------- /test-output/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Test results

6 | 7 | 8 | 9 |
SuitePassedFailedSkippedtestng.xml
Total010 
Default suite010Link
10 | -------------------------------------------------------------------------------- /test-output/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/passed.png -------------------------------------------------------------------------------- /test-output/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/msankrish92/SeleniumRealTimeAppTestCases/21ecd4d24bf0a241163c4c0529471c2e26eb6118/test-output/skipped.png -------------------------------------------------------------------------------- /test-output/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test-output/testng-reports.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0 0 5px 5px; 3 | } 4 | 5 | ul { 6 | margin: 0; 7 | } 8 | 9 | li { 10 | list-style-type: none; 11 | } 12 | 13 | a { 14 | text-decoration: none; 15 | } 16 | 17 | a:hover { 18 | text-decoration: underline; 19 | } 20 | 21 | .navigator-selected { 22 | background: #ffa500; 23 | } 24 | 25 | .wrapper { 26 | position: absolute; 27 | top: 60px; 28 | bottom: 0; 29 | left: 400px; 30 | right: 0; 31 | overflow: auto; 32 | } 33 | 34 | .navigator-root { 35 | position: absolute; 36 | top: 60px; 37 | bottom: 0; 38 | left: 0; 39 | width: 400px; 40 | overflow-y: auto; 41 | } 42 | 43 | .suite { 44 | margin: 0 10px 10px 0; 45 | background-color: #fff8dc; 46 | } 47 | 48 | .suite-name { 49 | padding-left: 10px; 50 | font-size: 25px; 51 | font-family: Times, sans-serif; 52 | } 53 | 54 | .main-panel-header { 55 | padding: 5px; 56 | background-color: #9FB4D9; /*afeeee*/; 57 | font-family: monospace; 58 | font-size: 18px; 59 | } 60 | 61 | .main-panel-content { 62 | padding: 5px; 63 | margin-bottom: 10px; 64 | background-color: #DEE8FC; /*d0ffff*/; 65 | } 66 | 67 | .rounded-window { 68 | border-radius: 10px; 69 | border-style: solid; 70 | border-width: 1px; 71 | } 72 | 73 | .rounded-window-top { 74 | border-top-right-radius: 10px 10px; 75 | border-top-left-radius: 10px 10px; 76 | border-style: solid; 77 | border-width: 1px; 78 | overflow: auto; 79 | } 80 | 81 | .light-rounded-window-top { 82 | border-top-right-radius: 10px 10px; 83 | border-top-left-radius: 10px 10px; 84 | } 85 | 86 | .rounded-window-bottom { 87 | border-style: solid; 88 | border-width: 0 1px 1px 1px; 89 | border-bottom-right-radius: 10px 10px; 90 | border-bottom-left-radius: 10px 10px; 91 | overflow: auto; 92 | } 93 | 94 | .method-name { 95 | font-size: 12px; 96 | font-family: monospace; 97 | } 98 | 99 | .method-content { 100 | border-style: solid; 101 | border-width: 0 0 1px 0; 102 | margin-bottom: 10px; 103 | padding-bottom: 5px; 104 | width: 80%; 105 | } 106 | 107 | .parameters { 108 | font-size: 14px; 109 | font-family: monospace; 110 | } 111 | 112 | .stack-trace { 113 | white-space: pre; 114 | font-family: monospace; 115 | font-size: 12px; 116 | font-weight: bold; 117 | margin-top: 0; 118 | margin-left: 20px; 119 | } 120 | 121 | .testng-xml { 122 | font-family: monospace; 123 | } 124 | 125 | .method-list-content { 126 | margin-left: 10px; 127 | } 128 | 129 | .navigator-suite-content { 130 | margin-left: 10px; 131 | font: 12px 'Lucida Grande'; 132 | } 133 | 134 | .suite-section-title { 135 | margin-top: 10px; 136 | width: 80%; 137 | border-style: solid; 138 | border-width: 1px 0 0 0; 139 | font-family: Times, sans-serif; 140 | font-size: 18px; 141 | font-weight: bold; 142 | } 143 | 144 | .suite-section-content { 145 | list-style-image: url(bullet_point.png); 146 | } 147 | 148 | .top-banner-root { 149 | position: absolute; 150 | top: 0; 151 | height: 45px; 152 | left: 0; 153 | right: 0; 154 | padding: 5px; 155 | margin: 0 0 5px 0; 156 | background-color: #0066ff; 157 | font-family: Times, sans-serif; 158 | color: #fff; 159 | text-align: center; 160 | } 161 | 162 | .top-banner-title-font { 163 | font-size: 25px; 164 | } 165 | 166 | .test-name { 167 | font-family: 'Lucida Grande', sans-serif; 168 | font-size: 16px; 169 | } 170 | 171 | .suite-icon { 172 | padding: 5px; 173 | float: right; 174 | height: 20px; 175 | } 176 | 177 | .test-group { 178 | font: 20px 'Lucida Grande'; 179 | margin: 5px 5px 10px 5px; 180 | border-width: 0 0 1px 0; 181 | border-style: solid; 182 | padding: 5px; 183 | } 184 | 185 | .test-group-name { 186 | font-weight: bold; 187 | } 188 | 189 | .method-in-group { 190 | font-size: 16px; 191 | margin-left: 80px; 192 | } 193 | 194 | table.google-visualization-table-table { 195 | width: 100%; 196 | } 197 | 198 | .reporter-method-name { 199 | font-size: 14px; 200 | font-family: monospace; 201 | } 202 | 203 | .reporter-method-output-div { 204 | padding: 5px; 205 | margin: 0 0 5px 20px; 206 | font-size: 12px; 207 | font-family: monospace; 208 | border-width: 0 0 0 1px; 209 | border-style: solid; 210 | } 211 | 212 | .ignored-class-div { 213 | font-size: 14px; 214 | font-family: monospace; 215 | } 216 | 217 | .ignored-methods-div { 218 | padding: 5px; 219 | margin: 0 0 5px 20px; 220 | font-size: 12px; 221 | font-family: monospace; 222 | border-width: 0 0 0 1px; 223 | border-style: solid; 224 | } 225 | 226 | .border-failed { 227 | border-top-left-radius: 10px 10px; 228 | border-bottom-left-radius: 10px 10px; 229 | border-style: solid; 230 | border-width: 0 0 0 10px; 231 | border-color: #f00; 232 | } 233 | 234 | .border-skipped { 235 | border-top-left-radius: 10px 10px; 236 | border-bottom-left-radius: 10px 10px; 237 | border-style: solid; 238 | border-width: 0 0 0 10px; 239 | border-color: #edc600; 240 | } 241 | 242 | .border-passed { 243 | border-top-left-radius: 10px 10px; 244 | border-bottom-left-radius: 10px 10px; 245 | border-style: solid; 246 | border-width: 0 0 0 10px; 247 | border-color: #19f52d; 248 | } 249 | 250 | .times-div { 251 | text-align: center; 252 | padding: 5px; 253 | } 254 | 255 | .suite-total-time { 256 | font: 16px 'Lucida Grande'; 257 | } 258 | 259 | .configuration-suite { 260 | margin-left: 20px; 261 | } 262 | 263 | .configuration-test { 264 | margin-left: 40px; 265 | } 266 | 267 | .configuration-class { 268 | margin-left: 60px; 269 | } 270 | 271 | .configuration-method { 272 | margin-left: 80px; 273 | } 274 | 275 | .test-method { 276 | margin-left: 100px; 277 | } 278 | 279 | .chronological-class { 280 | background-color: skyblue; 281 | border-style: solid; 282 | border-width: 0 0 1px 1px; 283 | } 284 | 285 | .method-start { 286 | float: right; 287 | } 288 | 289 | .chronological-class-name { 290 | padding: 0 0 0 5px; 291 | color: #008; 292 | } 293 | 294 | .after, .before, .test-method { 295 | font-family: monospace; 296 | font-size: 14px; 297 | } 298 | 299 | .navigator-suite-header { 300 | font-size: 22px; 301 | margin: 0 10px 5px 0; 302 | background-color: #deb887; 303 | text-align: center; 304 | } 305 | 306 | .collapse-all-icon { 307 | padding: 5px; 308 | float: right; 309 | } 310 | -------------------------------------------------------------------------------- /test-output/testng-reports.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('a.navigator-link').click(function() { 3 | // Extract the panel for this link 4 | var panel = getPanelName($(this)); 5 | 6 | // Mark this link as currently selected 7 | $('.navigator-link').parent().removeClass('navigator-selected'); 8 | $(this).parent().addClass('navigator-selected'); 9 | 10 | showPanel(panel); 11 | }); 12 | 13 | installMethodHandlers('failed'); 14 | installMethodHandlers('skipped'); 15 | installMethodHandlers('passed', true); // hide passed methods by default 16 | 17 | $('a.method').click(function() { 18 | showMethod($(this)); 19 | return false; 20 | }); 21 | 22 | // Hide all the panels and display the first one (do this last 23 | // to make sure the click() will invoke the listeners) 24 | $('.panel').hide(); 25 | $('.navigator-link').first().click(); 26 | 27 | // Collapse/expand the suites 28 | $('a.collapse-all-link').click(function() { 29 | var contents = $('.navigator-suite-content'); 30 | if (contents.css('display') == 'none') { 31 | contents.show(); 32 | } else { 33 | contents.hide(); 34 | } 35 | }); 36 | }); 37 | 38 | // The handlers that take care of showing/hiding the methods 39 | function installMethodHandlers(name, hide) { 40 | function getContent(t) { 41 | return $('.method-list-content.' + name + "." + t.attr('panel-name')); 42 | } 43 | 44 | function getHideLink(t, name) { 45 | var s = 'a.hide-methods.' + name + "." + t.attr('panel-name'); 46 | return $(s); 47 | } 48 | 49 | function getShowLink(t, name) { 50 | return $('a.show-methods.' + name + "." + t.attr('panel-name')); 51 | } 52 | 53 | function getMethodPanelClassSel(element, name) { 54 | var panelName = getPanelName(element); 55 | var sel = '.' + panelName + "-class-" + name; 56 | return $(sel); 57 | } 58 | 59 | $('a.hide-methods.' + name).click(function() { 60 | var w = getContent($(this)); 61 | w.hide(); 62 | getHideLink($(this), name).hide(); 63 | getShowLink($(this), name).show(); 64 | getMethodPanelClassSel($(this), name).hide(); 65 | }); 66 | 67 | $('a.show-methods.' + name).click(function() { 68 | var w = getContent($(this)); 69 | w.show(); 70 | getHideLink($(this), name).show(); 71 | getShowLink($(this), name).hide(); 72 | showPanel(getPanelName($(this))); 73 | getMethodPanelClassSel($(this), name).show(); 74 | }); 75 | 76 | if (hide) { 77 | $('a.hide-methods.' + name).click(); 78 | } else { 79 | $('a.show-methods.' + name).click(); 80 | } 81 | } 82 | 83 | function getHashForMethod(element) { 84 | return element.attr('hash-for-method'); 85 | } 86 | 87 | function getPanelName(element) { 88 | return element.attr('panel-name'); 89 | } 90 | 91 | function showPanel(panelName) { 92 | $('.panel').hide(); 93 | var panel = $('.panel[panel-name="' + panelName + '"]'); 94 | panel.show(); 95 | } 96 | 97 | function showMethod(element) { 98 | var hashTag = getHashForMethod(element); 99 | var panelName = getPanelName(element); 100 | showPanel(panelName); 101 | var current = document.location.href; 102 | var base = current.substring(0, current.indexOf('#')) 103 | document.location.href = base + '#' + hashTag; 104 | var newPosition = $(document).scrollTop() - 65; 105 | $(document).scrollTop(newPosition); 106 | } 107 | 108 | function drawTable() { 109 | for (var i = 0; i < suiteTableInitFunctions.length; i++) { 110 | window[suiteTableInitFunctions[i]](); 111 | } 112 | 113 | for (var k in window.suiteTableData) { 114 | var v = window.suiteTableData[k]; 115 | var div = v.tableDiv; 116 | var data = v.tableData 117 | var table = new google.visualization.Table(document.getElementById(div)); 118 | table.draw(data, { 119 | showRowNumber : false 120 | }); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /test-output/testng-results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | WOMEN>CLOTHING>Denim>Jeans&scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">... is not clickable at point (15, 7). Other element would receive the click:
...
37 | (Session info: chrome=83.0.4103.116) 38 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 39 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 40 | Driver info: org.openqa.selenium.chrome.ChromeDriver 41 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 42 | Session ID: 7db458f322cfc46e79a9db0161225d2e]]> 43 |
44 | 45 | WOMEN>CLOTHING>Denim>Jeans&scici=navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" da-event-click="2-2-1" data-scici="navbar_2~~tab01navbar02menu11dir01~~2_11_1~~real_1934~~SPcCccWomenCategory_default~~0~~0" data-node-id="640600054">... is not clickable at point (15, 7). Other element would receive the click:
...
46 | (Session info: chrome=83.0.4103.116) 47 | Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' 48 | System info: host: 'LAPTOP-AGHJRJVA', ip: '192.168.137.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171' 49 | Driver info: org.openqa.selenium.chrome.ChromeDriver 50 | Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 83.0.4103.116, chrome: {chromedriverVersion: 83.0.4103.39 (ccbf011cb2d2b..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:60847}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} 51 | Session ID: 7db458f322cfc46e79a9db0161225d2e 52 | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 53 | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 54 | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 55 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 56 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 57 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 58 | at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 59 | at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) 60 | at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 61 | at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552) 62 | at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285) 63 | at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84) 64 | at testCases.Shein.mouseover_on_Clothing_and_click_Jeans(Shein.java:22) 65 | at ✽.Mouseover on Clothing and click Jeans(file:src/main/java/feature/Shien.feature:6) 66 | ]]> 67 |
68 |
69 | 70 | 71 |
72 | 73 | 74 | 75 | 76 |
77 |
78 |
79 |
80 | -------------------------------------------------------------------------------- /test-output/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | --------------------------------------------------------------------------------