public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "chromedriver"); // test all the categories System.out.println( "\n/////////////////////\nstart testing chrome browser\n////////////////////"); WebDriver driver = new ChromeDriver(); testBrowser(driver); System.out.println( "\n/////////////////////\nstart testing firefox browser\n///////////////////"); WebDriver driver2 = new FirefoxDriver(); testBrowser(driver2); System.exit(0); }
public static void testBrowser(WebDriver driver1) { try { basicBrowserTester(driver1); // // just test some basic adding and browsing System.out.println("\nDone for basicBrowserTester."); shareButtonTest(driver1); System.out.println("\nDone for shareButtonTest without user login."); addWishListTest(driver1); // / try add to wishlist without user login System.out.println("\nDone for addWishListTest without user login."); addFittingRoomTest(driver1); // / try add to Fitting Room without user login System.out.println("\nDone for addFittingRoomTest without user login."); addItemTest(driver1); System.out.println("\nDone for addItemTest without user login."); logInUser(driver1); System.out.println("\nDone log in."); sleep(); basicBrowserTester(driver1); // // just test some basic adding and browsing System.out.println("\nDone for basicBrowserTester with user login."); shareButtonTest(driver1); System.out.println("\nDone for shareButtonTest with user login."); addWishListTest(driver1); // // try again with user lgoin System.out.println("\nDone for addWishListTest with user login."); addFittingRoomTest(driver1); // // try again with user lgoin System.out.println("\nDone for addFittingRoomTest with user login."); removeProductsFromWishList(driver1, 3); // / remove products from wish list System.out.println("\nDone for removeProductsFromWishList."); addItemTest(driver1); System.out.println("\nDone for addItemTest with user login."); // addComment(driver1, 0,0); logOutUser(driver1); driver1.close(); if (success) { System.out.println("\ntest successfully"); } } catch (Exception e) { System.out.println("\nException appearred, element not found.\n "); driver1.close(); System.exit(0); } }
@Test public void setUp() throws Exception { try { // ---------------------Maximize Window---------------- driver.manage().window().maximize(); // ---------------------Open URL---------------- System.setProperty( "webdriver.ie.driver", "C:\\Users\\nitish_ravindran\\Desktop\\IEDriverServer.exe"); /*WebDriver driver; driver=new InternetExplorerDriver();*/ driver.get("http://*****:*****@href='/SBCS-WEB/AdvancedSearch.do?moduleSelected=Scenarios']")).getAttribute("title").contains("Advanced Search "); } }); //-------------------------Logout----------------------------- WebElement logoutLinkImg=driver.findElement(By.cssSelector("a[href='/SBCS-WEB/logout.do']")); logoutLinkImg.click();*/ } // -------------------------End of Try block----------------------------- // -------------------------Catch Blocks----------------------------- catch (NoSuchElementException e) { System.out.println("-----------Element not found " + e); } /*catch(AssertionFailedError e) { System.out.println("------------Assertion failed " + e); }*/ /*catch(StaleElementReferenceException e) { System.out.println("-----------Stale Element" + e); }*/ catch (Exception e) { e.printStackTrace(); } finally { // driver.quit(); } }