Archive for the ‘Selenium’ Category.
April 2, 2013, 4:21 pm
Get the extension
I thought this would be the easy part. Turns out that the new chrome web store only lets you install directly to chrome.
Create And Use a profile
- After you download your crx file put it in the same repo as your test. Next create a chrome profile and use the add_extension method.
profile = Selenium::WebDriver::Chrome::Profile.new
profile.add_extension(File.dirname(__FILE__) +"/chrome_extensions/adblock/AdBlock_v2.5.61.crx")
- Now you can use the new profile to with a driver
Selenium::WebDriver.for(:chrome,:profile => profile)
Trouble Shooting
- be sure that your chromedriver is updated. I used 26.0.1383.0
- chrome 26.0.1410.43
- selenium-webdriver 2.31.0
May 29, 2012, 10:07 am
I had a great time attending the Test Automation Bazaar in Austin. Alister Scott put on a contest to see who could write a program to win Minesweeper. After checking out what was required, I started coding the Minesweeper robot. Before I noticed, I had spent hours coding tests and methods for the robot. It was one of the most addictive and exciting code I had written. I spent about 3 days coding along to get something to win on basic and intermediate level. I spent hours trying to win on advanced.
I ended up winning the Minesweeper Challenge! I encourage everyone to take a look at Alister’s code. Alister wrote some of the best cukes and examples I have seen. I was very impressed by the time he put into writing unit tests that work on logic only, taking the browser out of the mix. Thanks Alister for putting on the contest. If you wish to see what 3 days of coding gets you in a mine sweeper robot you can checkout my code on github. As I mentioned before I got really engaged with writing this code. I could have spent weeks tuning and polishing it. I did have a chance to refractor the code to use Nokogiri instead of the find all elements selenium method to check the game state. I believe that this might have actually slowed it down.
Sadly to say, I had to withdraw from polishing and tuning the code. If you want to run my robot checkout the code and run the test “Minesweeper should win” in this file.
Category:
Selenium |
Comments Off on Minesweeper Programming Contest. Using Selenium Web Driver to win Minesweeper