Selenium WebDriver
Selenium Roadmap & Comprehensive Review
Complete roadmap covering all Selenium concepts including browser operations, locators, web elements, Actions class, alerts, frames, and dropdowns.
Selenium Complete Roadmap
✨ Comprehensive Selenium Guide
This roadmap covers all essential Selenium concepts from basic browser operations to advanced automation techniques. Master these concepts to become proficient in web automation testing.
🚀 Browser Operations
Basic Operations
ChromeDriver driver = new ChromeDriver();
driver.get("url");
driver.manage().window().maximize();
Information Capture
String title = driver.getTitle();
String url = driver.getCurrentUrl();
Window Management
driver.switchTo().newWindow(WindowType.TAB);
driver.switchTo().newWindow(WindowType.WINDOW);
Navigation & Cleanup
driver.navigate().to("url");
driver.close(); // Current window
driver.quit(); // All browsers
🔍 Selenium Locators
Basic Locators
ID
driver.findElement(By.id("idValue"));
Name
driver.findElement(By.name("nameValue"));
Class
driver.findElement(By.className("classValue"));
Tag
driver.findElement(By.tagName("tagName"));
Advanced Locators
Link Text
driver.findElement(By.linkText("linkText"));
Partial Link
driver.findElement(By.partialLinkText("partial"));
CSS Selector
driver.findElement(By.cssSelector("css"));
XPath
driver.findElement(By.xpath("xpath"));
🎯 CSS Selector Techniques
Basic CSS Selectors
ID:
#idValueClass:
.classValueTag:
tagNameCombined:
tagName#idValueAttribute Selectors
Exact:
input[attribute='value']Starts with:
input[attribute^='start']Ends with:
input[attribute$='end']Contains:
input[attribute*='contains']XPath Methods
Single Attribute:
//tag[@att='value']Multiple Attributes:
//tag[@att='value' and @att2='value2']Text:
//tag[text()='value']Contains:
//tag[contains(@att,'value')]XPath Axes
Child:
/child::tagNameDescendant:
/descendant::tagNameFollowing:
/following-sibling::tagNamePreceding:
/preceding-sibling::tagName⚙️ Web Element Operations
Text Box Operations
•
isDisplayed() → boolean•
isEnabled() → boolean•
sendKeys() → void•
clear() → void•
getAttribute() → StringButton/Link Operations
•
isDisplayed() → boolean•
isEnabled() → boolean•
click() → void•
getText() → String•
getAttribute() → StringRadio/Checkbox Operations
•
isDisplayed() → boolean•
isEnabled() → boolean•
isSelected() → boolean•
click() → void🖱️ Actions Class
Mouse Events
•
click() - Single click•
doubleClick() - Double click•
contextClick() - Right click•
moveToElement() - Mouse hover•
dragAndDrop() - Drag and drop•
scrollToElement() - ScrollKeyboard Events
•
keyDown(Keys.CONTROL)•
keyUp(Keys.CONTROL)•
sendKeys("text")Action Chain
•
build() - Combine actions•
perform() - Execute actionsKnowledge Check
Knowledge Check
Question 1 of 5
Which method is used to switch focus from frame window to top window?
Key Points Summary
🎯 Locator Strategy
- • Prefer ID and Name locators for stability
- • Use CSS selectors for better performance
- • XPath for complex element relationships
- • Avoid absolute XPath paths
⚡ Actions Best Practices
- • Always call perform() after build()
- • Use explicit waits before actions
- • Handle stale element exceptions
- • Chain multiple actions efficiently
🔄 Frame Handling
- • Always switch to frame before interaction
- • Use defaultContent() to return to main
- • Handle nested frames carefully
- • Check frame existence before switching
🚨 Alert Management
- • Handle different alert types appropriately
- • Use explicit waits for alert presence
- • Capture alert text before dismissing
- • Handle authentication popups via URL