I'm writing an acceptance test for web using Robot Framework + Selenium2Library. The point is that web contain some input field that I can not automate (CAPTCHA), and I can't tell my vendor to turn off this feature while running test. So I have to input this field manually. Now I'm doing this:
Create User
[Arguments] ${username} ${password}
Open Browser ${URL} ${BROWSER}
Input Text username ${username}
Input Text password ${password}
Sleep 10 # XXX input CAPTCHA manually here!
Click Button submit
Page Should Contain ${username} has been created.
I've input CAPTCHA when I tell Robot Framework to Sleep 10, so far so good. But I wonder is there anyway to tell Robot Framework to wait indefinitely, then continue automate task after I finish input that CAPTCHA?
There is a keyword just for this purpose in the Dialog library that comes with Robot Framework.
Execute Manual Step Please complete the CAPTCHA portion of the form.
I can see a few options:
You can remove sleep and button clicking and do them yourself. Then you can use wait until page contains to continue after you has pushed submit button
Create User
[Arguments] ${username} ${password}
Open Browser ${URL} ${BROWSER}
Input Text username ${username}
Input Text password ${password}
Log Waiting for CAPTCHA
Wait Until Page Contains ${username} has been created. timeout=3600
You can also use Pause Execution keyword from Dialogs-library. This pauses execution until you click OK in a popup.
Create User
[Arguments] ${username} ${password}
Open Browser ${URL} ${BROWSER}
Input Text username ${username}
Input Text password ${password}
Pause Execution Enter captcha
Click Button submit
Page Should Contain ${username} has been created.
The most automated way I can think of is to use a CAPTCHA solving service. I believe they have an API where you send screenshot of your page and get a solved CAPTCHA back. I have never tried them and sharing screenshots of your software may not be an option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With