1. Glad you stopped in for a visit!

    Please feel free to peruse around and if you have a minute make sure to sign up for an account! We're one of the largest, most active, and helpful communities you'll find for learning about mTurk & registered accounts automatically get access to tons of useful features on the site.

    Features for members include:

    • The ability to post messages - our community is incredibly helpful & happy to welcome newcomers who are looking to learn the ropes!
    • Live thread update - no need to refresh pages to see new posts/HITs they flow onto the page automatically as they're posted.
    • Desktop alerts - direct PANDAs from exported HITs right on your desktop
    • Access to the full list of HITs exported through the Daily HIT Log
    • TurkerView account which will grant you extra access to HIT review information all across mTurk through TVJS

    But most importantly you'll be joining an amazing community. You'll find all types here, from stay-at-home Moms to IT pros. We're a great group - feel free to join us!

[Script] Attempting to modify a script.

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

  1. SmokedKipper

    SmokedKipper Well-Known Member

    Messages:
    947
    Gender:
    Male
    Ratings:
    +1,363 / 0 / -0
    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 Well-Known Member

    Messages:
    8,754
    Ratings:
    +17,242 / 22 / -2
    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 Well-Known Member

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

    slothbear Well-Known Member

    Messages:
    8,754
    Ratings:
    +17,242 / 22 / -2
    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.