Have unanswered Selenium questions? Want to learn how to use Selenium like a Pro? Join Dave Haeffner - author of The Selenium Guidebook - as he steps through the best and most useful tips & tricks from his weekly Selenium tip newsletter (Elemental Selenium).
12. Why use it?
• Faster execution times
• Also useful for a CI server
• Not limited to just Linux
13. Step 2 - Start PhantomJS w/ WebDriver flag
Step 1 - Download PhantomJS
http://phantomjs.org/download.html
Step 3 - Connect Your Test to PhantomJS
using Selenium Remote
NOTE
You can also connect PhantomJS to a Selenium Grid
http://se.tips/ghost-driver-grid
Option 1
14.
15. Step 2 - Tell Selenium where it is
Step 1 - Download PhantomJS
http://phantomjs.org/download.html
Step 3 - Launch Selenium with PhantomJS locally
Option 2
18. A Visual Testing Primer
• Check that an application’s UI appears correctly
• Can also be used to verify content
• Hundreds of assertions for a few lines of code
29. Visual Testing Write-ups
http://se.tips/se-visual-1 Getting Started
http://se.tips/se-visual-2 False Positives part 1
http://se.tips/se-visual-3 False Positives part 2
http://se.tips/se-visual-4 Add Visual Testing To Your Existing Tests
http://se.tips/se-visual-5 Add Visual Testing To Your BDD Tests
35. Configuration
• Use a proxy server to capture the traffic from your
Selenium test(s)
• Find the status code for the action you’re interested
in (e.g., visiting a URL)
• Assert that the status code is what you expect
39. Configuration
• Use a proxy server to manipulate the traffic from
your Selenium test(s)
• Identify third-party resources that are slow to load
(which could negatively impact your tests)
• Blacklist them (e.g., make it so they don’t load)
44. Configuration
• Use a proxy server to capture the traffic from your
Selenium test(s)
• Convert the HTTP Archive into a JMeter JMX file
• Run the new JMX file with JMeter to enact load on
your application (modify as needed)
60. Configuration
• Use Selenium to trigger a forgot password workflow
(to an send to a real email address) and keep the
browser session active
• Retrieve the e-mail and the password information
via the email provider’s API
• Use the password information in the active
Selenium session (if applicable)
65. • 3 page states available
• You can identify which state you’re in because
there is different header text for each
• When you’re in the control: A/B Test Control
• For the variation: A/B Test Variation 1
• When you’re not in a test: No A/B Test
http://the-internet.herokuapp.com/abtest
66. Configuration
• You can easily opt-out of A/B tests by
• forging a cookie
• appending a query to the URL
• This way you get a known state of the page which
isn’t likely to change without your knowledge
76. Two approaches
• Configure Selenium to download to local disk, and
delete the file when done
• Use an HTTP library, perform a HEAD request, and
check the headers for the correct content type &
length.
Why?
• An order of magnitude faster using Selenium
• No need to download the file