✖️Desired Capabilities
Last updated
Last updated
Desired capabilities are used in Selenium to configure browser and device-specific options when requesting a session from a remote WebDriver. It falls under the topic of cross-browser testing.
What is Cross Browser Testing? 💻🌎
Cross-browser testing is the practice of testing your website or application across different browsers, operating systems, and devices.
Why is it Important? ✅
👀 Users access your site on different browsers.
🤖 Rendering issues can occur on specific browsers.
🐛 Browser inconsistencies can cause bugs.
🏆 Ensures site works correctly everywhere.
Common Browsers to Test 💻
🦊 Firefox
🍎 Safari
💚 Chrome
🌏 Internet Explorer / Edge
🤖 Headless browsers
Common Testing Strategies 🧪
🔎 Manual testing on different browsers
🤖 Automated testing with multiple browsers
☁️ Use cloud based browser testing tools
Key Benefits ✅
🙅♂️ Avoid browser-specific bugs
💯 Ensure consistent experience
🏅 Improve quality
🛡️ Reduce technical debt
📈 Optimize conversion rates
Make sure to test across browsers for happy users everywhere! 😊🌎
They are a set of key-value pairs that define configuration options for a browser or device when creating a remote WebDriver session.
setBrowserName(String browserName)
sets the name of the browser to be used for the test.
setVersion(String version)
sets the version of the browser to be used for the test.
setPlatform(Platform platform)
sets the operating system to be used for the test.
setCapability(String key, String value)
sets a specific capability for the test.
setAcceptInsecureCerts(boolean acceptInsecureCerts)
sets whether to accept insecure SSL certificates.
setHeadless(boolean headless)
sets whether to run the browser in headless mode.
setProxy(Proxy proxy)
sets the proxy to be used for the test.
setPageLoadStrategy(PageLoadStrategy strategy)
sets the page load strategy for the test.
setUnhandledPromptBehaviour(UnhandledPromptBehaviour behaviour)
sets the behavior when an unhandled alert is encountered.
setJavascriptEnabled(boolean enable)
: Sets whether to enable JavaScript in the browser
Desired capabilities are passed to the WebDriver when creating a session:
They enable cross-browser testing by allowing you to switch the browser or device for your tests.
Different WebDriver implementations require different desired capabilities.