Tags » Selenium

Using OR Condition in Selenium WebDriver for any selector

To get all web elements on the page that have a specific class names, i.e. “blue” or “purple”

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
IWebElement status = wait.Until(d => d.FindElement(By.XPath(“//span[@class=’blue’ or @class=’purple’]”)));

Selenium

Implicit wait Vs. Explicit wait

Implicit wait

 WebDriver driver = new FirefoxDriver();  
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);  

Implicit waits are basically your way of telling WebDriver the latency that you want to see if specified web element is not present that WebDriver looking for. 195 more words

Selenium WebDriver

Moving Mouse Cursor

I created a function in my tests to move the mouse cursor off the page. The reason for this is because in some cases when I was trying to hover over a menu and select an option, I found that sometimes the test worked and sometimes it failed. 52 more words

.net

testng.xml file of selenium from command line solution

You will get exceptions like : All will be solved

A)Exception in thread “main” java.lang.NoClassDefFoundError: com/beust/jcommander/
ParameterException

B)org.testng.TestNGException ; No sourcedir was specified

c)Cannot find class in classpath: testR.java.getData… 143 more words

Cannot Find Class In Classpath:

Handling Modal Window in Selenium WebDriver

This would work for all browsers (FF, Chrome, IE).

 
public class ModalDialog {

        public static void main(String[] args) throws InterruptedException {
            // TODO Auto-generated method stub
            WebDriver driver = new InternetExplorerDriver();
            //WebDriver driver = new FirefoxDriver();
            driver.get("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm");
            String parent = driver.getWindowHandle();
            WebDriverWait wait = new WebDriverWait(driver, 10);
            WebElement push_to_create = wait.until(ExpectedConditions
                    .elementToBeClickable(By
                            .cssSelector("input")));
            push_to_create.click();
            waitForWindow(driver);
            switchToModalDialog(driver, parent);

        }

        public static void waitForWindow(WebDriver driver)
                throws InterruptedException {
            //wait until number of window handles become 2 or until 6 seconds are completed. 60 more words
Selenium WebDriver

Create a Cucumber Project by Integrating maven-cucumber-selenium-eclipse

This blog will explain the steps to follow for creating a simple Cucumber project.

Prerequisite: following should be installed:

  • Java
  • Eclipse
  • Maven
  • maven-eclipse-plugin
  • Cucumber-eclipse-plugin

Step 1) 1,075 more words

Cucumber