Does anyone have experiance with Captcha on "WatiN" library ?
The site I want to get data is having a "captcha" on the login page. I can enter that value if app can show captcha image and wait for my input in a given text box on app.
Can we achive that from this library, if you can like to have a sample.
ok...It seems you want to enter only captcha value manually..!!!other fields you want to automate.Ok the below solution may not be perfect but it works and its just an idea...or you can ask user to input the captcha value in an input box(use in place of msgbox),then take the value and put it in the captcha field.
IE ie=new IE();
ie.GoTo("http://captchas.net/registration/");
ie.TextField(Find.ByName("user")).Value="username";
ie.TextField(Find.ByName("mail")).Value="abcd#xyz.com";
//string captch_value="";
do
{
MessageBox.Show("Enter Captcha value...after entering correct captcha press Ok");
//captch_value=ie.Eval("window.prompt('enter captcha')");
}while(ie.ContainsText("Wrong Password entered. Try again"));
//ie.TextField(Find.ByName("password")).Value=captch_value;
ie.Button(Find.ByValue("Submit")).Click();
You can integrate Watin with a captcha solving service that has an API such as http://www.deathbycaptcha.com or similar site. So you would do the following.
Load the Page in Watin
Get the Captcha image
Submit it to the Captcha Solver API they will provide you with the results
Take that result and put it in the Captcha textbox.
As far as I know we can't automate all CAPTCHA's."Completely Automated Public Turing test to tell Computers and Humans Apart",As the name implies it is used to prevent automation.If we can automate whats the use of CAPTCHA?Only Poorly designed CAPTCHA's can be captured using complex matching algorithms.
Related
I am trying to use FormSubmit to submit a basic form from my React app to my gmail account. When I use the _subject hidden input from their documentation it works in their live demo but not in my code. Any suggestions??? And yes, I am using styled components so the form is not all HTML, but the form works as is, but the subject line always the same right now...
I have tried hard coding a subject instead of using my state variable, taking out my subject input and only having hidden _subject with hard coded value, I have tried using and fields, and I have tried making the input a styled component like the rest of my inputs
https://stackoverflow.com/a/42161567/20616453
I found this thread and it solved my question if anyone else has the same problem...putting the _subject in the response body fixes it!!!
Is there a way to REQUIRE a PayPal dropdown to be answered? Currently, my choices are 1. Select One, 2. Satchel Brown, and 3. Midnight Black. If I skip it, it accepts "Select One" as the option. What to do? Leave the first option blank? I don't want to use a default answer.
Are you using a custom button (code generated using a form) or a paypal supported button that you generated the code for in paypal?
If you are using a paypal custom created button, create a confirmation page and have it post the users choice to there. Then, using php, check to see that the users choice is one of the valid options. If it is not, then simply use the header('Location: http://www.MyWebsiteHere.com/Wherever.php?&error=Unselected') to send them back to the page and add a error message so if(isset($_GET['error'])), then echo $correspondingErrorMessage. Very simple thing if you do it like this.
I got a textbox that allows users to put image link (ex: http://abc.test.gif) & another textbox that allows user to put Alternate text (ex: "This is test.gif"), & a submit button.
When a user clicks on submit buton, the program will generate <img src="http://abc.test.gif" alt="This is test.gif"> this string & store it into DB for later use.
My question is: do i need to sanitize the imagelink "http://abc.test.gif" & the text in alt tag "This is test.gif"
For example, do i need to use UriUtils.isSafeUri("http://abc.test.gif"); & SafeHtmlUtils.fromString("This is test.gif"
You are deliberately allowing the user to input anything he want that will go into the src and the alt attributes of the img tag. This is indeed open to any kind of XSS attack. Have a look here for some examples that still work in recent browsers.
Also, you are storing the string in your DB for later use (guessing), so the attack may occur at later time, when you will use such string to create a node in the DOM, with even more unpredictable results.
One solution could be to store only the URL and the alternative string in the database (with a proper input validation, if any), and generate the safe img snippet right when you need it, with a simple template like the following (or programmatically using SafeHtmlBuilder).
public interface Template extends SafeHtmlTemplates {
#Template("<img src=\"{0}\" alt=\"{1}\"/>")
SafeHtml img(SafeUri uri, SafeHtml alternativeText);
}
To be used like:
template.img(
UriUtils.fromString(yourValidatedDbUrl),
SafeHtmlUtils.fromString(yourValidatedAlternativeText));
This way you:
validate the user input;
store only the validated values (as-are);
generate the img snippet in a safe way only when really needed.
I implemented Recaptcha to Silverstripe and it seems to work.
The only problem is that the formular and the captcha code are at the very end of the page and if you type in a wrong code then the page reloads and jumps back to the top so that the user doesn´t see the formular and captcha code anymore.
how can i make the window not to scroll to the top after entering a wrong captcha code?
Since the HTTP spec doesn't allow to a serverside redirection including an anchor tag, you'll need to use JavaScript to accomplish this. Since the field is highlighted with a validation message in the standard SilverStripe form rendering, you can use this to determine the state of the field once the submitted form loads again.
jQuery(document).ready(function() {
var captchaEl = jQuery('#MyCaptcha');
if(captchaEl.find('.message.required').length) {
window.scrollTo(0, captchaEl.scrollTop());
}
});
I am taking my first steps with Ajax while working on a Grails application. I am using
<g:form ...>
<g:submitToRemote ... />
</g:form>
in the most simple way and it worked great out of the box (Thanks grails!). The problem is, that the Ajax call needs about 2 seconds to return and update the html (at least on the test system) and during that time, the user can (and actually does quite often) hit the submit button again. At the moment this results in a 2nd call being made that finally ruins the output (an error msg says, that one cannot submit the same data twice).
What is the best way to prevent this?
Thanks in advance for your input!
The best way to handle this is to disable the submit button in your onSubmit() function. Honestly, I don't know why more sites don't do this. I often go the next step and instead of disabling the submit button, I put the submit button in a span tag and replace the contents of the span tag with static text "Please wait..." That way your users get visual feedback they pressed the button and "top men are working on it".
As dj_segfault said you can do that.
If you want to validate this in your controller, take a look in "Handling Duplicate Form Submissions" in the official docs:
http://grails.org/doc/latest/guide/theWebLayer.html#formtokens