Components of Selenium
- Selenium IDE
- Selenium RC
- Selenium Webdriver - communicated with Browser
- Selenium Grid
Limitations
- Image not supported
- no reports
- No RestAPI or Database support
- No Mobile testing
- Can not handle popup
- Dynamic content????
WebDriver Capabilities (not not in RC):
- multiple frames
- pop-ups
- browser windows
- alerts
- page navigation
- drag & drop
- Ajax
Object Repository
Wait:
- Implicit - wait for
- Explicit
- WebDriver wait
- Fluent wait
Locators types
- id
- name
- link Text
- Partial Link Text
- CSS Selector
- xpath
FindElement/elements
- driver.findElement(By.id("")
Size of the Window
- maximize()
- getSize()
- setSize()
- JavaScriptExecutor: executeScript - executeAsyncScript - for scroll
POM - Page Object Model
Page Factory
Action Class - mouse/keyboard
drag and drop, control key
Alerts
- void dismiss()
- void accept()
- String getText()
- void sendKeys(String stringToSend)
Robot (Native) - mouse & keyboard
- upload files
- keyPress()
- keyRelease()
- MouseMove()
- MousePress()
- mouseRelease()
Screenshot
- File src = ((TakeScreenshot)driver)getScreenshotAs(OutputType FILE);
Window Handle
- get.windowhandle()
- get.windowhandles()
- set
- switch to
- action
Listeners
- Event Listeners
Assert and verify
Proxy
String PROXY="192.168/0.0:4444";
Capability.setCapability(CapabilityType.PROXY,proxy)
Network Latency = driver.manage.pageLoadingTime()
Serversidelog: java -jar.jar -log selenium.log
Exceptions:
- WebDriverException
- NoAlertPresentException
- NoSuchElementException
- NoSuchFrameException
- NoSuchWindowException
- Timeout
driver.switchTo.frame() - name, number