The document discusses the history and evolution of Selenium and some of its key features. It describes how Selenium started as a solution to automate testing for a Python application and help address problems with browser compatibility. Over time, Selenium grew in popularity and was expanded through additions like the Selenium IDE, support for different browsers, and the ability to extend its functionality through user-defined scripts and customizations. The document emphasizes that true value comes from effectively implementing automation solutions and shares some strategies like using page object models, integrating with CI tools, and taking advantage of newer Selenium capabilities like WebDriver.
16. @testinggeek www.TestingGeek.com I want to extend Selenium with some new assertions,actions No problem User-extension.js is here for that.
17.
18.
19.
20. Collecting all the gems and putting in the treasure chest @testinggeek www.TestingGeek.com
21.
22.
23. @testinggeek www.TestingGeek.com SA /** * This method would just kill the PDF */ public void closesPDF(){ { String[] dialog = new String[] { "srctestresourcesKillAcroRd32.bat"}; try { Process p = Runtime.getRuntime().exec(dialog); System.out.println(p.getErrorStream().toString()); System.out.println(p.getInputStream().toString()); System.out.println(p.getOutputStream().toString()); System.out.println("After execution"); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("In the exception"); e.printStackTrace(); throw new AssertionError("No Dialogue box displayed"); } } }
32. @testinggeek www.TestingGeek.com import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.RenderedWebElement; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class TestingGeek { public static void main(String[] args) throws Exception { // The Firefox driver supports javascript WebDriver driver = new FirefoxDriver(); // Go to the TestingGeek home page driver.get("http://www.testinggeek.com"); // Enter the query string "Cheese" //WebElement query = driver.findElement(By.name("q")); WebElement menu= driver.findElement(By. id("menu27")); menu.click(); // query.sendKeys("Cheese"); // Sleep until the div we want is visible or 5 seconds is over long end = System. currentTimeMillis() + 5000; while (System. currentTimeMillis() < end) { // Browsers which render content (such as Firefox and IE) // return "RenderedWebElements" // RenderedWebElement resultsDiv = (RenderedWebElement) driver.findElement(By.className("gac_m")); RenderedWebElement resultsDiv = (RenderedWebElement) driver.findElement(By. id("menu27")); // If results have been returned, // the results are displayed in a drop down. if (resultsDiv.isDisplayed()) { break; } } // And now list the suggestions //List<WebElement> allSuggestions = driver.findElements(By. xpath("//td[@class='gac_c']")); List<WebElement> menus = driver.findElements(By. xpath("//div/div/div/ul/li[2]/ul")); for (WebElement menu1 : menus) { System. out.println(menu1.getText()); } } }