FE Automation Flashcards
Selenium Webdriver
Is an API and protocol that defines a language-neutral interface for controlling the web browsers. This is as if a real user is operating the browser.
Xpath
Is the language to query XML documents using XML path expression
Methods in Xpath
- contains() - uses partial value
- starts-with()
- text() - has to be an absolute text, not partial
Implicit wait
The driver is asked to wait for a specific amount of time for the element to be available in the DOM page
Syntax for implicit wait
driver.implicitly_wait(2)
Explicit wait
The driver is asked to wait until a certain condition is satisfied
Locators
Are addresses that identify a web element uniquely within the page
Types of basic locators
- ID
- NAME
- LINK_TEXT, PARTIAL_LINK_TEXT
- CLASS_NAME
- TAG_NAME
Types of customized locators
- CSS Selector
- Tag and ID
- Tag and Class
- Tag and attribute
- Tag, class and attribute - XPath
- Absolute XPath
- Relative XPath
What is tag name
Input, select, head, body, div…
Attributes in html
Is a piece of markup language used to adjust the behavior or display of an HTML element.
Example: name, ID, class
linkText or partialLinkText
The text from the web page and not from the html
How to find multiple elements
driver.findElements
How to return the number of elements
With len method
Example: number=driver.findElements…..
print(len(number)
What elements being retuned as multiple
Tags, classes
Syntax to use locators
from selenium.webdriver.common.by import By
driver.findElement(By.ID(“name”)
Can also be used for CLASS_NAME, TAG_NAME, NAME, LINK_TEXT, PARTIAL_LINK_TEXT)
Syntax to use CSS selector
driver.findElement(By.CSS_SELECTOR(“#email))
tag# - id
tag. - class
attribute - “tag[name=email]”
tag, class, attribute- (“input.inputtext[data-testid=royal_email]”)
tag is always optional
DOM
Document object model is an API interface provided by the browser. When a web page is loaded, the browser created a DOM of the page.