|
ID
|
|
Name
|
|
Link Text
|
|
CSS Selector - Tag and ID, Tag and Class, Tag and Attribute, Tag ID Class and Attribute , Inner Text
|
|
DOM - GetElementById, GetElementByName,dom:name,dom:index
|
|
XPATH
|
|
This wait can be considered as element detection timeout. Once defined in a script, this wait will be set for all the Web Elements on a page.
|
This wait can be considered as conditional wait, and is applied to a particular Web Element with a condition
|
|
|
Selenium keeps polling to check whether that element is available to interact with or not.
|
WebDriverWait wait = new WebDriverWait(Driver, 90);
|
|
|
Driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
|
wait.until(ExpectedConditions.visibilityOfElementsLocatedBy(By.xpath("//input[@type='text']")));
|
|
|
Get command
|
|
Get Title Command
|
|
Get current Url Command
|
|
Get Page Source Command
|
|
Close Command
|
|
Quit Command
|
|
Refresh Command
|
|
@Test
|
@BeforeMethod
|
@AferMethod
|
@BeforeClass
|
|
@BeforeGroup
|
@AfterGroup
|
@BeforeTest
|
@AfterTest
|
|
@BeforeSuite
|
@AfterSuite
|
||
|
Elements can be found by using
|
|
By Id
|
|
By Name
|
|
By Class Name
|
|
By Tag Name
|
|
By Link Text
|
|
By Partial Link Text
|
|
By CSS
|
|
By Xpath
|
|
Returns a single WebElement
|
Returns List of WebElements.
|
|
Syntax: WebElement findElement(By by)
|
Syntax: java.util.List<WebElement> findElements(By by)
|
|
Exception :NoSuchElementException
|
Exception:emptyListofWebElementObject
|
|
isSelected
|
not Selected
|
|
To Command
|
Refresh Command
|
|
Back Command
|
Forward Command
|
|
driver.switchTo.window("WindowName")
|
|
driver.switchTo.frame("FrameName")
|
|
driver.SwitchTo.alert()
|
|
Checked
|
not Checked
|
|
Single Slah '/' -> Look for the element immediately inside its parent element
|
|
Eg : Absolute path :/html/body/form/div/div[3]/[p1]/a
|
|
Double Slah '//' -> Look for any child or grand child inside parent element
|
|
eg: Releative path ://*[@id:loginform][p1]/a
|
|
selectByVisibleText
|
selectByIndex
|
|
selectByValue
|
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.