List of usage examples for org.openqa.selenium By xpath
public static By xpath(String xpathExpression)
From source file:facets_testing.java
@Test public void testCreatorMoreButton() { driver.setJavascriptEnabled(true);/*w w w.jav a 2 s. co m*/ try { driver.get(page_url); Thread.sleep(14); String element_text = driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/button")) .getText(); System.out.println( driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/button")).getText()); assertEquals(element_text, "More Creators"); } catch (Exception e) { System.out.println("More Creators button is not present.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreatorMoreButtonWorking() { driver.setJavascriptEnabled(true);/*from w ww. jav a 2 s .c om*/ try { driver.get(page_url); Thread.sleep(14); driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/button")).click(); WebElement more_creators_model = driver.findElement(By.xpath("//div[@id=\"drs_modal_creator_sim\"]")); assertTrue(more_creators_model.isEnabled()); } catch (Exception e) { System.out.println("More Creators button is not working.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreatorFiltering() { driver.setJavascriptEnabled(true);/*from w w w .j av a 2s .com*/ try { driver.get(page_url); Thread.sleep(14); String facet_name = driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[1]/b")) .getText(); String facet_text = driver .findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/a[1]/div[1]")).getText(); driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/a[1]/div[1]")).click(); String filter_text = driver.findElement(By.xpath("//div[@id=\"drs-selection\"]/a[1]")).getText(); assertEquals(filter_text, facet_name + " > " + facet_text); } catch (Exception e) { System.out.println("More Creators filtering is not working.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreatorUndoFiltering() { driver.setJavascriptEnabled(true);// w ww . ja va2 s . c o m try { driver.get(page_url); Thread.sleep(14); driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/a[1]/div[1]")).click(); driver.findElement(By.xpath("//div[@id=\"drs-selection\"]/a/span")); driver.findElement(By.xpath("//div[@id=\"drs-selection\"]/a/span")).click(); String finder = driver.findElement(By.xpath("//div[@id=\"drs-selection\"]")).getText(); assertEquals(finder, ""); } catch (Exception e) { System.out.println("More Creators unfiltering is not working.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearFacet() { driver.setJavascriptEnabled(true);/* w w w .j a va 2s . c o m*/ try { driver.get(page_url); Thread.sleep(14); String element_text = driver.findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[1]/b")) .getText(); System.out.println( driver.findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[1]/b")).getText()); assertEquals(element_text, "Creation year"); } catch (Exception e) { System.out.println("Creation Year facet not found. Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearLinkPresent() { List<String> creator_years = new ArrayList<>(); driver.setJavascriptEnabled(true);//from w ww . ja va 2 s . c o m try { driver.get(page_url); Thread.sleep(14); List<WebElement> creation_years_list = driver .findElements(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/a/div[1]")); for (WebElement year : creation_years_list) { creator_years.add(year.getText()); } assertThat(creator_years, JUnitMatchers.hasItem("1958")); } catch (Exception e) { System.out.println("Creation year is not present.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearLinkNotPresent() { List<String> creator_years = new ArrayList<>(); driver.setJavascriptEnabled(true);/*w ww . j a v a 2 s . c om*/ try { driver.get(page_url); Thread.sleep(14); List<WebElement> creation_years_list = driver .findElements(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/a/div[1]")); for (WebElement year : creation_years_list) { creator_years.add(year.getText()); } assertThat(creator_years, not(JUnitMatchers.hasItem("20000"))); } catch (Exception e) { System.out.println("Creation year is falsely present.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearMoreButton() { driver.setJavascriptEnabled(true);/*from ww w.j ava2 s. c om*/ try { driver.get(page_url); Thread.sleep(14); String element_text = driver .findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/button")).getText(); System.out.println(driver .findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/button")).getText()); assertEquals(element_text, "More Creation years"); } catch (Exception e) { System.out.println("More Creation Years button is not present.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearMoreButtonWorking() { driver.setJavascriptEnabled(true);/*from ww w. j a v a 2 s. c o m*/ try { driver.get(page_url); Thread.sleep(14); driver.findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/button")).click(); WebElement more_creation_years_model = driver .findElement(By.xpath("//div[@id=\"drs_modal_creation_year_sim\"]")); assertTrue(more_creation_years_model.isEnabled()); } catch (Exception e) { System.out.println("More Creation Years button is not working.Error : " + e); } }
From source file:facets_testing.java
@Test public void testCreationYearFiltering() { driver.setJavascriptEnabled(true);// ww w. j a v a 2 s . c o m try { driver.get(page_url); Thread.sleep(14); String facet_name = driver.findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[1]/b")) .getText(); String facet_text = driver .findElement(By.xpath("//div[@id=\"drs_creation_year_sim\"]/div/div[2]/a[1]/div[1]")).getText(); driver.findElement(By.xpath("//div[@id=\"drs_creator_sim\"]/div/div[2]/a[1]/div[1]")).click(); String filter_text = driver.findElement(By.xpath("//div[@id=\"drs-selection\"]/a[1]")).getText(); assertEquals(filter_text, facet_name.toLowerCase() + "_sim > " + facet_text); } catch (Exception e) { System.out.println("Creation Year filtering is not working.Error : " + e); } }