Selenium is a great tool for the automated testing of web applications. CAPTCHA is a way to prevent automated tools from accessing your web applications. So the two are mutually exclusive, by design.
Selenium can only be used to test a web app protected by CAPTCHA if a human intervenes for the test. So, if you are testing an 8 page transaction that includes a CAPTCHA on page 2, for example, you can still save tons of time by automating everything else with Selenium but have the test pause for human interaction during the specific section that requires a CAPTCHA response.
This example assumes you are already familiar with how to write a Selenium test, in HTML.
... the first part of your test goes above here...
<tr>
<td>clickAndWait</td>
<td>login</td>
<td></td>
</tr>
<tr><td rowspan="1" colspan="3">human tester must enter CAPTCHA...</td></tr>
<tr>
<td>waitForPageToLoad</td>
<td>60000</td>
<td></td>
</tr>
<tr>
<td>waitForTitle</td>
<td>Title of Next Page Here</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>FieldOnNextPage</td>
<td>Test</td>
</tr>
... continue on with the rest of your test. That worked for me in TestRunner, at least when the speed was set to slow.
If you are only going to be using TestRunner, as opposed to using a tool like ant to run Selenium tests during a scripted build, you could more easily just insert the following Selenium command into your test, forcing the test to wait until you click the Continue button in TestRunner:
<tr>
<td>break</td>
<td></td>
<td></td>
</tr>
Note: if you are a scammer, screw you. Further note to scammers: the preceding code won't help you in your scam pursuits, because it doesn't defeat CAPTCHA, it just allows a human to do what only humans can do and let the bots do the rest.
No comments:
Post a Comment