Archives: FAQs
Working With Pop-ups In Selenium WebDriver:
This function will fetch message on Pop-up This function will Canceling pop-up in Selenium-WebDriver
Finding the text using the PageSource
driver.getPageSource().contains(“TEXT that you want to see on the page”);
How to run Selenium WebDriver tests from command line?
java -jar selenium-server.jar -htmlSuite “*firefox” “localhost” “C:\mytestsuite.html” “C:\results.html”
How to pause a test execution for 5 seconds at a specific point?
We can pause test execution for 5 seconds by using the wait command.driver.wait(5);
What are the verification points available in Selenium?
Different types of verification points in Selenium are: To check element is presentif(driver.findElements(By.Xpath(“value”)).size()!=0){System.out.println(“Element is present”);}else{System.out.println(“Element is absent”);} To check element is visibleif(driver.findElement(By.Id(“submit”)).isDisplayed()){System.out.println(“Element is visible”);}else{System.out.println(“Element is visible”);} To check element is enabledif(driver.findElement(By.Id(“submit”)).isEnabled()){System.out.println(“Element is enabled”);}else{System.out.println(“Element is disabled”);} To check text is presentif(driver.getPageSource().contains(“Text”)){System.out.println(“Text is present”);}else{System.out.println(“Text is not present”);}