Selenium 2 Commands

Jetzt loslegen. Gratis!
oder registrieren mit Ihrer E-Mail-Adresse
Selenium 2 Commands von Mind Map: Selenium 2 Commands

1. Navigation

1.1. <WebDriver>

1.1.1. WebDriver driver = new FirefoxDriver();

1.1.2. .navigate

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

1.1.2.2. .forward driver.navigate().forward();

1.1.2.3. .refresh driver.navigate().refresh();

1.1.2.4. .back driver.navigate().back();

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

2. Interrogation

2.1. or

2.1.1. Inspection

2.2. <WebDriver>

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

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

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

2.3. <WebElement>

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

2.3.2. .getText

2.3.2.1. element.getText();

2.3.3. .getAttribute

2.3.3.1. element.getAttribute("name");

2.3.4. .getTagName

2.3.4.1. element.getTagName()

2.3.5. .isDisplayed

2.3.5.1. element.isDisplayed()

2.3.6. .isEnabled

2.3.6.1. element.isEnabled()

2.3.7. .isSelected

2.3.7.1. checkboxElement.isSelected()

2.3.7.2. radiobuttonElement.isSelected()

2.3.8. .getSize

2.3.8.1. element.getSize();

2.3.9. .getLocation

2.3.9.1. element.getLocation()

2.3.10. .getCssValue

2.3.10.1. element.getCssValue()

2.3.11. support

2.3.11.1. Select

2.3.11.1.1. .isMultiple

2.3.11.1.2. .getOptions

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

2.4. location <WebDriver> <WebElement>

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

2.4.2. .findElement

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

2.4.3. .findElements

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

2.4.4. By

2.4.4.1. .id

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

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

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

2.4.4.2. .xpath

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

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

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

2.4.4.3. .cssSelector

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

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

2.4.4.3.3. http://overapi.com/css/

2.4.4.4. .className

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

2.4.4.5. .linkText

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

2.4.4.6. .name

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

2.4.4.7. .tagName

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

2.4.4.8. .partialLinkText

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

2.4.5. support

2.4.5.1. ByChained

2.4.5.2. ByIdOrName

3. Manipulation

3.1. <WebElement>

3.1.1. .click

3.1.1.1. checkbox

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

3.1.1.2. checkbox option

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

3.1.1.3. button

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

3.1.1.4. radiobutton

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

3.1.2. .clear

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

3.1.3. .sendKeys

3.1.3.1. multiple arguments

3.1.3.2. special Keys.

3.1.3.2.1. ENTER

3.1.3.2.2. etc.

3.1.3.3. Keys.chord

3.1.3.3.1. modifiers

3.1.4. .submit

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

3.1.5. support

3.1.5.1. Select

3.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]")));

3.1.5.1.2. selectByIndex

3.1.5.1.3. selectByVisibleText

3.1.5.1.4. selectByValue

3.1.5.1.5. deselectAll

3.1.5.1.6. getFirstSelectedOption

3.1.5.1.7. Other

3.2. <Actions>

3.2.1. .keyDown

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

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

3.2.2. .keyUp

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

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

3.2.3. .sendKeys

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

3.2.3.1.1. Will press the letter a

3.2.4. .clickAndHold

3.2.4.1. action.clickAndHold(nameofwebelement).perform()

3.2.4.1.1. Click and hold the mouse button

3.2.5. .click

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

3.2.6. .doubleClick

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

3.2.7. .moveToElement

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

3.2.8. .moveByOffset

3.2.9. .contextClick

3.2.10. .dragAndDrop

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

3.2.11. .dragAndDropBy

3.2.12. .perform

3.2.12.1. build and perform now

4. Domain

4.1. Cookies

4.1.1. Interrogation

4.1.1.1. <WebDriver>.manage()

4.1.1.1.1. .getCookies

4.1.1.1.2. .getCookieNamed

4.1.2. Manipulation

4.1.2.1. <WebDriver>.manage()

4.1.2.1.1. addCookie

4.1.2.1.2. deleteAllCookies

4.1.2.1.3. deleteCookie

4.1.2.1.4. deleteCookieNamed

4.1.2.2. Cookie

4.1.2.3. Cookie.Builder

4.2. Windows

4.2.1. Interrogation

4.2.1.1. <WebDriver>

4.2.1.1.1. .getWindowHandle

4.2.1.1.2. .getWindowHandles

4.2.1.1.3. .manage().window()

4.2.2. Navigation

4.2.2.1. <WebDriver>

4.2.2.1.1. .switchTo().window

4.2.3. Manipulation

4.2.3.1. <WebDriver>

4.2.3.1.1. .manage().window()

4.3. Frames

4.3.1. Navigation

4.3.1.1. .switchTo

4.3.1.1.1. .frame

4.3.1.1.2. .defaultContent

4.4. html5

4.5. logging

4.6. (JavascriptExecutor)

4.6.1. executeScript

4.6.2. executeAsyncScript

4.6.3. N,I,M,S

4.7. Drivers

4.7.1. remote

4.7.2. chrome

4.7.3. firefox

4.7.4. opera

4.7.5. IE

4.8. Alerts

4.8.1. Navigation

4.8.1.1. <WebDriver>

4.8.1.1.1. .switchTo().alert()

4.8.2. Interrogation

4.8.2.1. .getText

4.8.3. Manipulation

4.8.3.1. .dismiss

4.8.3.2. .accept

4.8.3.3. .sendKeys

5. Synchronisation

5.1. support

5.1.1. ExpectedConditions

5.1.2. WebDriverWait

5.1.3. ExpectedCondition

5.1.4. FluentWebDriverWait

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

5.2.1. implicitlyWait

5.2.2. pageLoadTimeout

5.2.3. setScriptTimeout