List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver
public FirefoxDriver()
From source file:com.jpablo.test.NavigateWikipedia.java
public void doAnotherSearchFF(String sendKeys1, String sendKeys2) throws InterruptedException { /*// w ww .j a va 2 s . c om 1. Launch Firefox explorer 2. Open Wikipedia main page 3. Open Wikipedia in English 4. Type a word to search 5. Click on Search button 6. Open Wikipedia in Spanish 7. Type another word to search 8. Click on Search button 9. Close Firefox */ driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click(); Thread.sleep(10000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(sendKeys1); searchBox.submit(); Thread.sleep(5000); link = driver.findElement(By.linkText("Espaol")); link.click(); Thread.sleep(10000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(sendKeys2); searchBox.submit(); Thread.sleep(5000); driver.quit(); }
From source file:com.jpablo.test.NavigateWikipedia.java
public void doSearchAutoSuggest(String sendKeys) throws InterruptedException { /*//from w w w . j a v a 2 s. c o m 1. Launch Firefox explorer 2. Open Wikipedia main page 3. Open Wikipedia in English 4. Type a word to search 5. Compare the word to search vs the list elements */ driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click(); Thread.sleep(8000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(sendKeys); List<WebElement> optionsToSelect = driver.findElements(By.xpath("//div[@class='suggestions-result']")); System.out.println("Word to search: " + sendKeys); System.out.println("Size of Autosuggest is: " + optionsToSelect.size()); for (WebElement option : optionsToSelect) { System.out.println(""); System.out.println("Values are: \n" + option.getText()); System.out.println("Band " + option.getText().equals(sendKeys)); if (option.getText().equals(sendKeys)) { System.out.println("Selecting: " + sendKeys); option.click(); break; } } Thread.sleep(5000); driver.quit(); }
From source file:com.jpablo.test.NavigateWikipedia.java
public void doSearchAutoSuggestIndex(String sendKeys) throws InterruptedException { /*//from www. ja va 2 s .com 1. Launch Firefox explorer 2. Open Wikipedia main page 3. Open Wikipedia in English 4. Type a word to search 5. Compare the word to search vs the list elements */ int ind; driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click(); Thread.sleep(8000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(sendKeys); List<WebElement> optionsToSelect = driver.findElements(By.xpath("//div[@class='suggestions-result']")); System.out.println("Word to search: " + sendKeys); System.out.println("Size of Autosuggest is: " + optionsToSelect.size()); for (WebElement option : optionsToSelect) { System.out.println("Values are: \n" + option.getText()); System.out.println("Band " + option.getText().equals(sendKeys)); } ind = indice(optionsToSelect.size()); System.out.println("Index is " + ind); optionsToSelect.get(ind).click(); Thread.sleep(5000); driver.quit(); }
From source file:com.jpablo.test.NavigateWikipedia.java
public void doSearchWordsMap(List<String> wordList) throws InterruptedException { Map<String, String> map = new HashMap<String, String>(); driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click();//www .j av a2 s. c om for (String cad : wordList) { map.put(cad, cad.toString()); System.out.println(map.get(cad)); Thread.sleep(8000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(map.get(cad)); searchBox.submit(); } Thread.sleep(5000); driver.quit(); }
From source file:com.jpablo.test.NavigateWikipedia.java
public void doSearchWordsMap2(Map<String, String> map) throws InterruptedException { Iterator<String> it = map.keySet().iterator(); driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click();/*from w w w. j a v a2 s. c o m*/ while (it.hasNext()) { String key = it.next(); System.out.println(map.get(key)); Thread.sleep(8000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys(map.get(key)); searchBox.submit(); } Thread.sleep(5000); driver.quit(); }
From source file:com.jpablo.test.TestWikipediaFF.java
@BeforeClass public static void setUpClass() { baseURL = "http://www.wikipedia.org"; try {/* ww w . j a v a 2s . c o m*/ driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } catch (Exception e) { throw new IllegalStateException("Can't start a web driver", e); } }
From source file:com.jpablo.test.TutorialSelenium.java
public void testFirefox() throws InterruptedException { driver = new FirefoxDriver(); driver.get("http://www.wikipedia.org"); link = driver.findElement(By.linkText("English")); link.click();// w w w . j a v a 2 s . c o m Thread.sleep(10000); /*partialLinkText = driver.findElement (By.partialLinkText("the Bank")); partialLinkText.click(); */ //Thread.sleep(10000); link = driver.findElement(By.linkText("Espaol")); link.click(); Thread.sleep(30000); linkText = driver.findElement(By.linkText("Software")); linkText.click(); Thread.sleep(10000); searchBox = driver.findElement(By.id("searchInput")); searchBox.sendKeys("Software"); searchBox.submit(); Thread.sleep(5000); driver.quit(); }
From source file:com.korotkin.WebTest.utils.WebBrowser.java
License:Open Source License
private WebBrowser() { //System.setProperty("webdriver.chrome.driver","path - to - chromedriver.exe"); driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { public void run() { driver.close();//from ww w .j a v a 2s . c o m driver.quit(); } })); }
From source file:com.kurento.kmf.test.sanity.KwsBase.java
License:Open Source License
@Before public void setup() { driver = new FirefoxDriver(); serverAddress = KmfMediaApiProperties.getThriftKmfAddress().getHost(); serverPort = KurentoServicesTestHelper.getAppHttpPort(); createHtmlPages();/*from w w w . ja v a 2s .c o m*/ KurentoServicesTestHelper.startHttpServer(); }
From source file:com.kurento.test.selenium.BaseSeleniumTst.java
License:Open Source License
private void setup(Class<? extends WebDriver> driverClass) { if (driverClass.equals(FirefoxDriver.class)) { driver = new FirefoxDriver(); } else if (driverClass.equals(ChromeDriver.class)) { String chromedriver = null; if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX) { chromedriver = "chromedriver"; } else if (SystemUtils.IS_OS_WINDOWS) { chromedriver = "chromedriver.exe"; }/*from www . ja v a2s.c o m*/ System.setProperty("webdriver.chrome.driver", new File("target/webdriver/" + chromedriver).getAbsolutePath()); ChromeOptions options = new ChromeOptions(); // This flag avoids a warning in chrome. See: // https://code.google.com/p/chromedriver/issues/detail?id=799 options.addArguments("--test-type"); driver = new ChromeDriver(options); } }