haterapps / fake-data

Fake Data - A form filler you won't hate
39 stars 2 forks source link

Read part of site and do math to it. #9

Closed m1chaelbarry closed 3 years ago

m1chaelbarry commented 3 years ago

I want to take text from site, in inspector it looks like this: <label for="captcha">What is 3 + 10?</label> and add these two numbers and put them in text field. How can i do it?

haterapps commented 3 years ago

Hello,

You can use the following code for the captcha input field:

return function() {
    var text = $('label[for="captcha"]').text();
    var result = eval(text.replace(/[^0-9\+\-\*\/]/g,''))
    return result;
}

Let me know if that works.

m1chaelbarry commented 3 years ago

Hello,

You can use the following code for the captcha input field:

return function() {
  var text = $('label[for="captcha"]').text();
  var result = eval(text.replace(/[^0-9\+\-\*\/]/g,''))
  return result;
}

Let me know if that works.

Thank you, it works perfectly!