Selenium Flashcards
What is Selenium?
Selenium is a free (open source) automated testing suite for web applications across different browsers and platforms. It is quite similar to HP Quick Test Pro (QTP now UFT) only that Selenium focuses on automating web-based applications.
What are the advantages of using Selenium over QTP?
QTP and Selenium are the most used tools in the market for software automation testing. Hence it makes sense to compare the pros of Selenium over QTP.
What are the disadvantages of using Selenium over QTP?
Here are some disadvantages when comparing these two technologies
What is WebDriver?
WebDriver is a web automation framework that allows you to execute your tests against different browsers, not just Firefox, Chrome (unlike Selenium IDE).
WebDriver also enables you to use a programming language in creating your test scripts (not possible in Selenium IDE).
You can now use conditional operations like if-then-else or switch-case. You can also perform looping like do-while.
What is the syntax for instantiating a new driver class?
The syntax is dependent on which browser the user plans to use. The syntax for FireFox, Google Chrome, and Internet Explorer in order are:
WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();
What are locators?
Locators provide a way to access the HTML elements from a web page to perform operations on it. Types of locators include:
- Id
- Name
- Classname
- Link text
- CSS selector
- Xpath
What would be an example of an unreliable id?
If an id includes alpha numeric characters, then it is not reliable
What is an example of an unreliable classname?
Class names should not include spaces
From what direction does Selenium scan the DOM?
Selenium scans from top left to bottom right
What is an example of an unreliable xpath?
If an xpath starts with html, it is not reliable
What is the syntax for verifying xpaths and CSS locators in the DOM console?
$(“”) for CSS
$x(“”) for xpath
What is the syntax for an xpath?
//tagname[@attribute=’value’]
What are the syntaxes for CSS locators?
tagName[attribute=’value’]
tagName#id
tagname.classname
What is the syntax for an xpath regular expression?
//tagName[contains(@attribute,’value’)]
What is the syntax for a CSS regular expression?
tagName[Atrribute*=’value’]