Mechanical Turk externalquestion error when submitting hit - mechanicalturk

I have managed to create a HIT with an external question that calls an html file hosted in an S3 server. I have worked in the sandbox environment. When I create the hit, I get the following error when I try to submit the hit as a worker:
There was a problem submitting your results for this HIT.
This HIT is still assigned to you. To try this HIT again, click "HITs Assigned To You" in the navigation bar, then click "Continue work on this HIT" for the HIT. If this problem persists, you can contact the Requester for this HIT using the "Contact" link above.
To return this HIT and continue working on other HITs, click the "Return HIT" button.
I have already read multiple forums trying to figure out the problem. When I check out the source in the developer tools, it seems to have all the necessary parameters set:
</style><iframe height="400" scrolling="auto" frameborder="0" align="center" src="https://BUCKET.s3.amazonaws.com/index.html?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&hitId=3N2YPY1GI6BYD6C5MRBYOYBJJSEEVE&workerId=A1YJU5SNGQQP00&turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe>
Also, I made sure I don't have any button named 'submit'. Any ideas of how I could debug this thing?

The issue here is usually that you're not submitting the appropriate information back to MTurk. You need to send the assignmentId parameter in addition to at least one other named field. I often just add a &foo=bar (or similar) to the end of the submit URL. So you should be submitting to something like:
https://workersandbox.mturk.com/mturk/externalSubmit?assignmentId=34J10VATJGBKANG4MDCHRA6ME53QIH&foo=bar
That's for the sandbox. For the live server, switch the base URL to https://www.mturk.com.

Amazon MT HITs seems to be printing a generic error message for a wide range of issues. This causes the problem to be particularity hard to debug.
For me, the error occurred since I was not assigning "name" attribute to my input elements in the form.
You must include the HTML name attribute in the input field definition. Make your name attributes descriptive because they are used as the column headings in the Results table.
If you are using the GUI to build and deploy your tasks, I recommend giving this document a good read and see if you have missed something.
MT Requestor UI guide
Hope this helps.

Related

Auto login to website using script or bookmark

I've been trying to figure this out using various different methods. I'm trying to create a script/bookmark or some type of quick action to open a browser tab or window with a specific URL, and automatically log me in using my credentials. I'm not all that concerned about security for this at the moment.
At first I figured I'd try to use a javascript bookmark to do this, but nothing I found in my research worked. Next I tried to create a bash script, but I couldn't figure out how to send the credentials in via the terminal. Most recently, I literally copied the source code of a site, created a local file and tried to hack together something where I could prefill the form data with credentials and use JS to submit the form, and I've gotten close with this, but for some reason when I use the JS submit function, it errors out and says that the username and password are invalid. But when i turn off the submit function and manually click "log in" on my local html page, it works as expected. I want this to be a one click process, so the idea of using onload/submit or something to that affect is really important to me.
The site I'm testing with has a Rails backend and my next attempt might be trying to use POST to do what I'm thinking, but that's currently outside of my level of knowledge on the subject.
Anyone answering: i do not want to use a password manager to accomplish this.
My requirement is that i will either be able to a) run a script or b) use a 1-click option to do this per website. Ideally i'd be able to set this up in a sort of programmatic way to do this with multiple sites, but I'd be happy with 1 at the moment.
i know similar questions have been answered before, but I haven't been able to use information from those posts (the ones I've seen anyway) to figure out a good way to do this.
Create a bookmark for the current page you have opened.
Edit the bookmark
Change the value for the URL to something like this.
(javascript:(function(){CODE_GOES_HERE_FROM_BELLOW})();
find the field for username and password on the page.
Given example for hotmail
var inputs = document.getElementsByTagName('input'); for(var i=0;i<inputs.length;i++){if(inputs[i].name === 'passwd'){inputs[i].value = 'YOUR_PASSWORD'}else if(inputs[i].name === 'loginfmt'){inputs[i].value = 'YOUR_USERNAME'}}; document.getElementById(document.getElementsByTagName('form')[0].id).submit();
OR
try out casperjs.
The proposed solution didn't work for me and rather than spending tons of time installing a testing framework that I'll never use other than for this purpose, I decided to try to do this another way.
First, I found out that the reason my JS wasn't working before is because the site did not allow a JS submit to be done, or atleast that's what it seemed to be when I got this error: "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience"
The javascript I was using was in fact working, just not submitting. I used the following code to fill the fields (using "Class Name" elements on the page since there was no name or ID):
document.getElementsByClassName('username')[0].setAttribute('value', 'user');
document.getElementsByClassName('password')[0].setAttribute('value', 'password');
As I mentioned, the problem was when I tried to use JQuery to submit the form: document.getElementsByClassName('loginForm')[0].submit();
Which is when the above error cropped up. I can't really say for sure whether this is the root of the cause, but the page does submit, but I get an invalid username/password error when I do
I haven't figured out a great way to get around this just yet, but my short-term, "hacky" solution was to use Applescript to send a return keystroke to the browser to submit the form. I'd ideally like to figure out how to get the submission to work using JQuery, but I'm not sure how to get around it.

What is the proper way to test mandatory field in selenium

I am testing my web application using Selenium. All the form validation in the web application is done by HTML5 and some JS(for safari browser). I want to know what is the proper way to test the form validation.
Currently I am using one approach, i.e Before I filled up a mandatory field I clicked on the submit button. If the page is not refreshed then I assume the form validation working correctly. But I think there should be a better approach to do it. I am unable to find any proper solution. Any suggestion will be highly appreciated.
I also go through this link. But it is not working for me because it is not enough to have required attribute (eg required attribute does not work in older Safari browser).
Rather than checking if the page is refreshed or not, you should instead expect that it is not and that a certain error message or field highlighting or something is applied to the current page. When in an error state, the input fields probably get given an extra class, or an error div/span might be added to the DOM, try checking for that sort of thing

PrestaShop - Reload CMS page with additional parameters

Situation: I needed to add form with POST method to CMS page. I created custom hook and a module displaying the form successfully. Then I need to react to user input errors eg. when user doesn't enter email address I need to detect it, display the whole page again together with the form and with "errors" in user input clearly stated.
Problem: The problem is to display the WHOLE page again with connected information (eg. about errors etc.). In the module PHP file when I add this kind of code,
return $this->display(__FILE__, 'modulename.tpl');
it (naturally) displays ONLY the form, not the whole CMS page with the form.
In case of this code,
Tools::redirectLink('cms.php?id_cms=7');
I can't get to transfer any information by GET neither POST method.
$_POST['test'] = 1;
Tools::redirectLink('cms.php?id_cms=7&test');
I tried to assign to smarty variables too
$smarty->assign('test', '1');
(I need to use it in .tpl file where the form itself is created) but no way to get it work.
{if isset($test)}...,
{if isset($smarty.post.test)}...,
{if isset($_POST['test'])}... {* neither of these conditionals end up as true *}
Even assigning a GET parameter to url has no impact, because there is link rewriting to some kind of friendly url I guess, no matter I included other argument or not. ([SHOPNAME]/cms.php?id_cms=7&test -> [SHOPNAME]/content/7-cmspage-name)
My question is: is there a way to "redirect" or "reload" current page (or possibly any page generally) in prestashop together with my own data included?
I kind of explained the whole case so I'm open to hear a better overall solution than my (maybe I'm thinking about the case in a wrong way at all). This would be other possible answer.
The simplest method would be to use javascript to validate the form - you can use jQuery to highlight the fields that are in error; providing visual feedback on how the submission failed. In effect you don't allow the user to submit the form (and thus leave the page) until you're happy that the action will succeed. I assume that you will then redirect to another page once a successful submission has been received.
There's lots of articles and how-tos available for using javascript, and indeed jQuery for form validation. If you want to keep the site lean and mean, then you can provide an override for the CMS controller and only enqueue the script for the specific page(s) you want to use form validation on.
If the validation is complex, then you might be best using AJAX and just reloading the form section of your page via a call to your module. Hooks aren't great for this kind of thing, so you might want to consider using an alternative mnethod to inject your code onto the cms page. I've written a few articles on this alternative approach which can be found on my prestashop blog

Amazon Mechanical Turk submit button not working

The following is a snippet of a survey I would like to do on Amazon Mechanical Turk.
${offer_text1} : ${offer_text2}
I'm aware of the product
I'm NOT aware of the product
1
2
3
It shows up as two radio buttons to choose from and a drop down to choose a value from.
I used a survey template. However, when I actually tried publishing it, a "submit" button
showed up in the survey (notice I have not inserted it here) and the golden "submit hit" button from amazon is greyed out. Am I missing something obvious?
Do I need to call GET/POST somewhere to post the results to amazon. Per the documentation, mturk should automatically get it for me. (I could be wrong here).
Any help much appreciated.
The MTurk Requester User Interface automatically wraps everything in a set of <form></form> tags. Undoubtedly, you've put an additional set of such tags nested in the HIT as well, which then causes the HIT to fail (i.e., to gray-out the submit button and make it impossible to submit).

Wiki Page Library issue in SharePoint 2010

I would really appreciate it if someone would help me out with this issue.
I'm using SharePoint 2010. I created a Wiki Page Library without changing any of the library settings, and created a new Wiki page, all that went fine but once I started adding text and then tried to save the changes on the page, this message appears:
"You must specify a value for this required field"
I don't know what to do, there is no required field and I can't really fix that... so please help me with that message!!
Fatima, I don't know if you ever got your question answered, but this is a known issue with Publishing features. There is a field that is marked as required, but is not displayed on the page. I beleive it's the column/field called "Name". If you look through the Site Content Types and find "wiki page", you'll see that status is marked as "Required". Changing that should fix the issue for you.
This was caused by a Place holder missing from the Main area of your master page.
Even if you’ve moved it to a asp:Panel and declared it as false at the bottom of your master page you’ll still get the error.
All you need is to move content place holder
<asp:ContentPlaceHolder id=“PlaceHolderPageTitleInTitleArea” runat=”server”></asp:ContentPlaceHolder>
within the s4-bodyContainer div , within the s4-ca div seems to work best. Save the master page and that’s it. that no more irritating message.
Reference: http://sharepointbrandingteam.wordpress.com/2012/05/25/sharepoint-2010-error-you-must-specify-a-value-for-this-required-field/
Alternatively, you can try the solution suggested here