public static void main(String[] args) { // TODO Auto-generated method stu2) Close all the frames other than center - System.setProperty( "webdriver.chrome.driver", "C:\\Users\\Admin\\MyWorkspace\\SeleniumWebDriver\\chromedriver_win32\\chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("http://www.crystalcruises.com"); String parentWindowHandle = driver.getWindowHandle(); driver.findElementByLinkText("GUEST CHECK-IN").click(); Set<String> allWindowHandles = driver.getWindowHandles(); for (String windowHandle : allWindowHandles) { driver.switchTo().window(windowHandle); } driver.findElementByLinkText("click here").click(); Set<String> allWndHandles = driver.getWindowHandles(); for (String wndHandle : allWndHandles) { driver.switchTo().window(wndHandle); } Select dropdown = new Select(driver.findElementByClassName("goog-te-combo")); dropdown.selectByValue("ta"); // Run configuration ->Common tab -> Other radio button -> UTF 8 -> Click Apply -> Click Run String text = driver.findElementByXPath("//*[@id='mainBody']/div[1]/div[2]").getText(); System.out.println(text); // not getting tamil text? }
public void run() { actions = new Actions(driver); driver.get("http://dancing9.interest.me/index.m"); 메인페이지를_로딩한다(); Vote메뉴_Vote를_클릭한다(); Vote메뉴_SoloStage를_클릭한다(); About메뉴_WinnersPrize를_클릭한다(); About메뉴_Audition을_클릭한다(); About메뉴_MCIntroduction을_클릭한다(); 팀메뉴_블루아이vs레드윙스를_클릭한다(); 팀메뉴_마스터를_클릭한다(); 팀메뉴_멤버링크를_클릭한다(); Video메뉴_Video를_클릭한다(); Video메뉴_Clip를_클릭한다(); Video메뉴_Preview를_클릭한다(); 게시판메뉴_NotiveViewersOpinion를_클릭한다(); 게시판메뉴_News를_클릭한다(); More메뉴_DanceTerms를_클릭한다(); More메뉴_Webtoon을_클릭한다(); More메뉴_Sponsor를_클릭한다(); driver.close(); }
@Test(groups = {"sf", "qa", "functest"}) public void test_a() throws InterruptedException, IOException { driver.get("https://mhe--qa.cs24.my.salesforce.com"); // SF - login // SFAdminLoginPage sfAdminLoginPage = new SFAdminLoginPage(driver); Thread.sleep(2000); sfAdminLoginPage.enterSFUsername("*****@*****.**"); sfAdminLoginPage.enterSFPassword("Abhijazz9"); sfAdminLoginPage.clickSFSubmitLogin(); Thread.sleep(5000); // Click Contacts Button SFAdminHomePage sfAdminHomePage = new SFAdminHomePage(driver); sfAdminHomePage.clickProductsviewerButton(); Thread.sleep(5000); SFAdminProductViewerPage sfAdminProductViewerPage = new SFAdminProductViewerPage(driver); // Searching Products sfAdminProductViewerPage.enterSearchDetails("1429299843"); sfAdminProductViewerPage.clickSearchButton(); Thread.sleep(9000); sfAdminProductViewerPage.clickProductExpander(); Thread.sleep(5000); assertTrue(sfAdminProductViewerPage.verifyISBN().isDisplayed()); // assertTrue(sfAdminSamplingWizardPage.verifyEAN().isdisplayed()); assertTrue(sfAdminProductViewerPage.verifyLongtitle().isDisplayed()); // assertTrue(sfAdminSamplingWizardPage.verifyShorttitle().isdisplayed()); }
public void textExtraction(Article a) { // storePageExtractionCondition(); System.out.println("starting driver : " + a.getLink()); driver.get(a.getLink()); System.out.println("driver started"); Newspaper newspaper = a.getPaper(); List<String> parts = new ArrayList<String>(); parts.add("header"); parts.add("date"); parts.add("preface"); parts.add("body"); parts.add("upleft-component"); parts.add("downright-component"); for (String s : parts) { StringBuilder headerString = new StringBuilder(); System.out.println("part : " + s); String descriptor = newspaper.getCondition(s); System.out.println("element to find : " + descriptor); List<WebElement> lista = null; lista = driver.findElements(By.tagName(descriptor)); for (Iterator<WebElement> it1 = lista.iterator(); it1.hasNext(); ) { WebElement webElement = it1.next(); headerString.append(webElement.getText()); } // headerText = findByDescriptor(descriptor, i, n); // WebElement selectheaderText = findByDescriptor(descriptor, i, n); if (headerString.length() > 0) { System.out.println("str to print : " + headerString.toString()); if (s.equalsIgnoreCase("header")) { a.setTitle(headerString.toString()); } else if (s.equalsIgnoreCase("preface")) { a.setPreface(headerString.toString()); } else if (s.equalsIgnoreCase("date")) { // a.setPreface(headerString.toString()); } else if (s.equalsIgnoreCase("upleft-component")) { // a.setPreface(headerString.toString()); } else if (s.equalsIgnoreCase("downright-component")) { // a.setPreface(headerString.toString()); } else { a.setBody(headerString.toString()); } } } }
// DOES NOT WORK @Test public void descendant() { // System.setProperty("webdriver.ie.driver", "F:\\SELENIUM DRIVERS\\IEDriverServer.exe"); // InternetExplorerDriver driver = new InternetExplorerDriver(); System.setProperty("webdriver.chrome.driver", "F:\\SELENIUM DRIVERS\\chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("C:\\Users\\shree\\Desktop\\HTML\\WebTable.HTML"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); WebElement td = driver.findElement(By.cssSelector("td[innerText='John']")); System.out.println(td.getText()); }
public static void get(String url) { driver.get(url); }