Way to Automate Pressing of Specific Accept Button on mTurk Page Load?
I'm trying to figure out a way to simply click on a specific button (which is an href) on a particular page when it loads, via a userscript written in Javascript within Tampermonkey. It seems straightforward enough, but I haven't gotten any of my code to work, after multiple iterations.
Here is the full source code of the href and button that I want pressed:
And here is a screenshot of everything, including the DIVs that the button is contained within (the mouse is hovered over the necessary Accept button):
Way to Automate Pressing of Specific Accept Button on mTurk Page Load?
I'm trying to figure out a way to simply click on a specific button (which is an href) on a particular page when it loads, via a userscript written in Javascript within Tampermonkey. It seems straightforward enough, but I haven't gotten any of my code to work, after multiple iterations.
Here is the full source code of the href and button that I want pressed:
<span data-react-class="require('reactComponents/workPipeline/SubmitAcceptTaskForm')
['SubmitAcceptTaskFormLink']" data-react-props="{"text":"accept","refTag":"wwpacpt_warning"}">
accept<//a><//span><//span>
Here is the code that I have been trying to use (I have tested each individual line separately, and to no avail):
// ==UserScript== // @name Accept Button WIP // @include https://worker.mturk.com/projects/* // ==/UserScript==
location.href = document.querySelector("a[href='#']");
document.querySelector("a[data-reactid='.4.0']").click();
document.getElementsByClassName(".4.0")[0].click();
location.href = document.querySelector("a[href='#']");
location.data-reactid = document.querySelector("a[data-reactid='.4.0']").click();
document.querySelector("span[data-reactid='.4']").click();
And here is a screenshot of everything, including the DIVs that the button is contained within (the mouse is hovered over the necessary Accept button):
https://i.stack.imgur.com/Jskhq.png