1. TurkerHub is now TurkerView Forum!

    To better integrate the services & streamline user experience we've moved the forum to TurkerView's domain. From now on you'll only have to log in once across both services and you'll have access to all the features available on what used to be two different websites.

    If you notice any bugs please let us know!

    Dismiss Notice

[Script] Attempting to modify a script.

Discussion in 'mTurk Scripts & Resources' started by SmokedKipper, Aug 24, 2018.

  1. SmokedKipper

    SmokedKipper Survey Slinger

    Messages:
    1,062
    Gender:
    Male
    Ratings:
    +1,594
    I saw some of the a9's up again and thought i would try to modify a script from the last batch.
    Sadly i have had no luck. for the a9's up right now i tried

    // ==/UserScript==

    document.querySelector('input[id=waterfall[value=NoWaterfall]').click();
    document.querySelector('input[id=double-brested][value=Nodouble-brested]').click();
    document.querySelector('input[id=hood][value=NoHood]').click();
    document.getElementById('submitButton').focus();

    Sorry to pester.
    any tips would be great. TY
     
    • Useful / Informative Useful / Informative x 1
  2. slothbear

    slothbear Survey Slinger

    Messages:
    9,156
    Ratings:
    +18,036
    It looks like you might be missing some quotation marks and brackets. Also, it looks the id is wrong on some of those.

    Code:
    document.querySelector('[value="NoWaterfall"]').click();
    document.querySelector('[value="NoDoubleBreasted"]').click();
    document.querySelector('[value="NoHood"]').click();
    document.getElementById('submitButton').focus();
    
    You don't really need as much info as you gave with querySelector because it grabs all the elements of the page and searches through them trying to match stuff. You don't have it give it everything about the element you're looking for, just part of it. That could lead to problems though, because radio buttons, checkboxes, etc... could share a name or value or whatever.
     
    • Useful / Informative Useful / Informative x 2
  3. SmokedKipper

    SmokedKipper Survey Slinger

    Messages:
    1,062
    Gender:
    Male
    Ratings:
    +1,594
    Crap they are missing, Ty kindly @slothbear
    I think i should start with some basics before i try editing other scripts.
     
  4. slothbear

    slothbear Survey Slinger

    Messages:
    9,156
    Ratings:
    +18,036
    No problem. Do you use MTS? That helped me work on learning to script because it saves the HIT's source page so you can go back and work on it later. Also, I think messing with other people's scripts is a great way to learn.