Selenium 2 Commands

Get Started. It's Free
or sign up with your email address
Rocket clouds
Selenium 2 Commands by Mind Map: Selenium 2 Commands

1. Domain

1.1. Cookies

1.1.1. Interrogation

1.1.1.1. <WebDriver>.manage()

1.1.1.1.1. .getCookies

1.1.1.1.2. .getCookieNamed

1.1.2. Manipulation

1.1.2.1. <WebDriver>.manage()

1.1.2.1.1. addCookie

1.1.2.1.2. deleteAllCookies

1.1.2.1.3. deleteCookie

1.1.2.1.4. deleteCookieNamed

1.1.2.2. Cookie

1.1.2.3. Cookie.Builder

1.2. Windows

1.2.1. Interrogation

1.2.1.1. <WebDriver>

1.2.1.1.1. .getWindowHandle

1.2.1.1.2. .getWindowHandles

1.2.1.1.3. .manage().window()

1.2.2. Navigation

1.2.2.1. <WebDriver>

1.2.2.1.1. .switchTo().window

1.2.3. Manipulation

1.2.3.1. <WebDriver>

1.2.3.1.1. .manage().window()

1.3. Frames

1.3.1. Navigation

1.3.1.1. .switchTo

1.3.1.1.1. .frame

1.3.1.1.2. .defaultContent

1.4. html5

1.5. logging

1.6. (JavascriptExecutor)

1.6.1. executeScript

1.6.2. executeAsyncScript

1.6.3. N,I,M,S

1.7. Drivers

1.7.1. remote

1.7.2. chrome

1.7.3. firefox

1.7.4. opera

1.7.5. IE

1.8. Alerts

1.8.1. Navigation

1.8.1.1. <WebDriver>

1.8.1.1.1. .switchTo().alert()

1.8.2. Interrogation

1.8.2.1. .getText

1.8.3. Manipulation

1.8.3.1. .dismiss

1.8.3.2. .accept

1.8.3.3. .sendKeys

2. Synchronisation

2.1. support

2.1.1. ExpectedConditions

2.1.2. WebDriverWait

2.1.3. ExpectedCondition

2.1.4. FluentWebDriverWait

2.2. <WebDriver>.manage().timeouts().

2.2.1. implicitlyWait

2.2.2. pageLoadTimeout

2.2.3. setScriptTimeout

3. Navigation

3.1. <WebDriver>

3.1.1. WebDriver driver = new FirefoxDriver();

3.1.2. .navigate

3.1.2.1. driver.navigate().to("http://google.com");

3.1.2.2. .forward driver.navigate().forward();

3.1.2.3. .refresh driver.navigate().refresh();

3.1.2.4. .back driver.navigate().back();

3.1.3. .get driver.get("http://google.com")

4. Interrogation

4.1. or

4.1.1. Inspection

4.2. <WebDriver>

4.2.1. .getCurrentUrl String pageCurrentURL= driver.getCurrentUrl();

4.2.2. .getTitle String fooPageTitle = driver.getTitle();

4.2.3. .getPageSource String pageContent = driver.getPageSource(); pageContent.contains("Text about ");

4.3. <WebElement>

4.3.1. .WebElement element; element = driver.findElement(By.id("zzz");

4.3.2. .getText

4.3.2.1. element.getText();

4.3.3. .getAttribute

4.3.3.1. element.getAttribute("name");

4.3.4. .getTagName

4.3.4.1. element.getTagName()

4.3.5. .isDisplayed

4.3.5.1. element.isDisplayed()

4.3.6. .isEnabled

4.3.6.1. element.isEnabled()

4.3.7. .isSelected

4.3.7.1. checkboxElement.isSelected()

4.3.7.2. radiobuttonElement.isSelected()

4.3.8. .getSize

4.3.8.1. element.getSize();

4.3.9. .getLocation

4.3.9.1. element.getLocation()

4.3.10. .getCssValue

4.3.10.1. element.getCssValue()

4.3.11. support

4.3.11.1. Select

4.3.11.1.1. .isMultiple

4.3.11.1.2. .getOptions

4.3.11.1.3. etc. (deselectAll(), getFirstSelectedOption(), selectByValue, selectByVisibleText)

4.4. location <WebDriver> <WebElement>

4.4.1. WebDriver driver = new FirefoxDriver(); WebElement element;

4.4.2. .findElement

4.4.2.1. driver.findElement(By.name("elementsName"));

4.4.3. .findElements

4.4.3.1. driver.findElements(By.name("elementsName"));

4.4.4. By

4.4.4.1. .id

4.4.4.1.1. driver.findElement(By.id("elementID"));

4.4.4.1.2. http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-id

4.4.4.1.3. http://www.w3schools.com/tags/att_global_id.asp

4.4.4.2. .xpath

4.4.4.2.1. driver.findElement(By.xpath("/html/head/title/"));

4.4.4.2.2. http://www.w3schools.com/xpath/xpath_syntax.asp

4.4.4.2.3. http://docs.seleniumhq.org/docs/03_webdriver.jsp#by-xpath

4.4.4.3. .cssSelector

4.4.4.3.1. driver.findElement(By.cssSelector("input[t ype='foo'][value='test']"));

4.4.4.3.2. http://www.w3schools.com/cssref/css_selectors.asp

4.4.4.3.3. http://overapi.com/css/

4.4.4.4. .className

4.4.4.4.1. element = driver.findElement( By.className( "test" ));

4.4.4.5. .linkText

4.4.4.5.1. driver.findElement(By.linkText("test"))

4.4.4.6. .name

4.4.4.6.1. driver.findElement(By.name("test"));

4.4.4.7. .tagName

4.4.4.7.1. driver.findElement(By.tagName("iframe"));

4.4.4.8. .partialLinkText

4.4.4.8.1. driver.findElement(By.partialLinkText("test"));

4.4.5. support

4.4.5.1. ByChained

4.4.5.2. ByIdOrName

5. Manipulation

5.1. <WebElement>

5.1.1. .click

5.1.1.1. checkbox

5.1.1.1.1. .WebElement checkBox1 = driver.findElement(By.id("test']"); checkBox1.click();

5.1.1.2. checkbox option

5.1.1.2.1. WebElement dropDownList = driver.findElement(By.id("test")); WebElement dropDownOptionInList = dropDownList.findElement(By.cssSelector("option[value='test']")); dropDownOption.click();

5.1.1.3. button

5.1.1.3.1. WebElement submitButton = driver.findElement(By.id("test")); submitButton.click();

5.1.1.4. radiobutton

5.1.1.4.1. WebElement radioButton = driver.findElement(By.id("test")); radioButton.click();

5.1.2. .clear

5.1.2.1. driver.findElement(By.id("test")).clear();

5.1.3. .sendKeys

5.1.3.1. multiple arguments

5.1.3.2. special Keys.

5.1.3.2.1. ENTER

5.1.3.2.2. etc.

5.1.3.3. Keys.chord

5.1.3.3.1. modifiers

5.1.4. .submit

5.1.4.1. WebElement loginButtonLocator = findElement(By.id("login")); driver.findElement(loginButtonLocator).submit();

5.1.5. support

5.1.5.1. Select

5.1.5.1.1. Dropdownlit example: <select> <option value="one">Value1</option> <option value="two">Value2</option> <option value="three">Value3</option> </select> Select selectedDropDown = new Select(driver.findElement(By.xpath("//div/div[1]")));

5.1.5.1.2. selectByIndex

5.1.5.1.3. selectByVisibleText

5.1.5.1.4. selectByValue

5.1.5.1.5. deselectAll

5.1.5.1.6. getFirstSelectedOption

5.1.5.1.7. Other

5.2. <Actions>

5.2.1. .keyDown

5.2.1.1. Actions action = new Actions(driver); action.keyDown(Keys.CONTROL)

5.2.1.1.1. Will hold down the Ctrl key or any key you choose

5.2.2. .keyUp

5.2.2.1. Actions action = new Actions(driver); action.keyDown(Keys.CONTROL))

5.2.2.1.1. Will stop holding down the Ctrl key or any other key you choose

5.2.3. .sendKeys

5.2.3.1. Actions action = new Actions(driver); action.SendKeys("a")

5.2.3.1.1. Will press the letter a

5.2.4. .clickAndHold

5.2.4.1. action.clickAndHold(nameofwebelement).perform()

5.2.4.1.1. Click and hold the mouse button

5.2.5. .click

5.2.5.1. Actions actions = new Actions(driver); WebElement imageSpan = driver.findElement(By.className("test")); actions.moveToElement(imageSpan); action.click();

5.2.6. .doubleClick

5.2.6.1. Actions action = new Actions(driver); action.doubleClick(myElemment); action.perform();

5.2.7. .moveToElement

5.2.7.1. Actions actions = new Actions(driver); WebElement imageSpan = driver.findElement(By.className("test")); actions.moveToElement(imageSpan);

5.2.8. .moveByOffset

5.2.9. .contextClick

5.2.10. .dragAndDrop

5.2.10.1. WebElement element = driver.findElement(By.name("source")); WebElement target = driver.findElement(By.name("target")); (new Actions(driver)).dragAndDrop(element, target).perform();

5.2.11. .dragAndDropBy

5.2.12. .perform

5.2.12.1. build and perform now