imacros: submitting textarea form (enter key maybe?) - imacros

Question: How to simulate an ENTER (to submit a text in a live chat)?
(if there is an alternative to using the ENTER key, like using javascript in imacros to trigger an event, that would be great too)
Explanation:
I am trying to submit a comment in a live chat that uses a <textarea> element for input. Here is the source code:
<form class="chatbox nolabel">
<textarea class="textbox" type="text" size="70" autocomplete="off" name="message" style="resize: none; overflow-y: hidden;"></textarea>
</form>
I have attempted various different approaches of inputting the word "hello" and pressing the ENTER key (so that hello is sent to the users reading), however the only thing I am capable of doing is inputting the word "hello".
Attempt 1:
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=NAME:message CONTENT=hi
Results from Attempt 1:
When recording, this is the code that appeared when I started typing in the text area, and it successfully places the content into the textarea, however I didn't see any code being recorded when I press the ENTER key, so I assume that is the issue in this case.
Attempt 2: (event recording mode)
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>FORM>TEXTAREA:nth-of-type(2)" CHARS="hi"
WAIT SECONDS=1
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>FORM>TEXTAREA:nth-of-type(2)" KEY=13
Results from Attempt 1:
In this case, I tried using the Keypress type with events to simulate hitting the ENTER key, however what resulted was getting a "hi(newline)".
Any ideas?

Sometimes other key event types may help:
EVENT TYPE=KEYDOWN SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>FORM>TEXTAREA:nth-of-type(2)" KEY=13
or
EVENT TYPE=KEYUP SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>FORM>TEXTAREA:nth-of-type(2)" KEY=13

Related

Can not press enter key with textarea in imacros

I just tried to hit the enter key with imacros in firefox but doesnt work.
The photo of my div is:
The image of my div
I tried using the following code:
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY>#number>DIV:nth-of-type(5)>DIV:nth-of-type(3)>DIV:nth-of-type(2)>textarea" KEY=13
But not work why is not working keypress with imacros.
my version is:
8.9.7
Sometimes other key event types might help:
EVENT TYPE=KEYDOWN SELECTOR="HTML>BODY>#number>DIV:nth-of-type(5)>DIV:nth-of-type(3)>DIV:nth-of-type(2)>textarea" KEY=13
or
EVENT TYPE=KEYUP SELECTOR="HTML>BODY>#number>DIV:nth-of-type(5)>DIV:nth-of-type(3)>DIV:nth-of-type(2)>textarea" KEY=13

iMacro text field Inputting issue

hopefully you can help me. This is my attempt at using a macro to add text into a text field on a website.​
This is my current iMacro code, which opens the text box (by clicking a couple of buttons) however doesn't activate the text box nor add any text into it:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://datatron.l2inc.com/#resources?selected=brandTab5229&brands=5229
TAG POS=1 TYPE=BUTTON ATTR=TXT:Create<SP>New<SP>Resources<SP>for<SP>Brand
TAG POS=1 TYPE=BUTTON ATTR=ID:add-urls
PROMPT "Please enter something:" !VAR1
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:form-control CONTENT={{!VAR1}}
The last lines are my attempt adding my own text (VAR1) into the textbox. The relevant html code (created by javascript) simply reads as this:
​<textarea class="form-control urls-textarea" rows="10" placeholder="irrelevant placeholder text"></textarea>
Do you know where I am going wrong??
Best regards
Roman
Try to record your manual typing wlth 'Experimental event recording mode'.
Taking into account the html code you provided, the event command may look like:
EVENTS TYPE=KEYPRESS SELECTOR="textarea[class='form-control urls-textarea']" CHARS={{!VAR1}}

Enter key not working in imacros

I want my form to submit when I hit the Enter key in the search input control, because the submit button is not available.
When I hit Enter manually it's working properly: the search keyword is submitted successfully. But when I record the successful keypress event using iMacros, it does not do anything during the replay. The event is recorded as KEY=13.
The iMacros code I'm using:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>DIV>SECTION>ASIDE>DIV>DIV>UL>LI:nth-of-type(7)>DIV>UL>LI:nth-of-type(2)>BUTTON" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV>DIV>SECTION>ASIDE>DIV>DIV>UL>LI:nth-of-type(7)>DIV>FORM:nth-of-type(2)>TEXTAREA" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV>DIV>SECTION>ASIDE>DIV>DIV>UL>LI:nth-of-type(7)>DIV>FORM:nth-of-type(2)>TEXTAREA" CHARS="2nd search"
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV>DIV>SECTION>ASIDE>DIV>DIV>UL>LI:nth-of-type(7)" KEY=13
Here is the test page of my case: http://zeccartourisme.com/test.html

APEX 3.2: Popup confirmation after page is submitted

Working with APEX 3.2:
I want to show a confirmation popup on Page 2 when Page 1 has successfully been submitted.
Right now I can get the text from the 'Process Success Message' to appear on Page 2, but instead of the 'Process Success Message' text, I want an alert popup. Any idea how to do that?
NOTE: I don't want to put javascript on the 'Submit' button of Page 1, because if there is a validation error, the alert popup will appear anyway every time the 'Submit' button is clicked. I just want the popup to appear only if Page 1 has successfully submitted.
You could do this:
1) Edit the page template used by Page 2. Edit the Success Message subtemplate and put a span tag around the #SUCCESS_MESSAGE# placeholder like this:
<span id="successMessage">#SUCCESS_MESSAGE#</span>
2) Create some Javascript on Page 2 to run when the page is loaded that does this:
if ($x('successMessage')) alert ($x('successMessage').innerHTML);
The Success Message is only rendered if there is a success message to display, and so the alert will only happen when there is a success message to display also.
3) You could suppress the display of the success message on the page itself if you want by adding style="display:none" to the outer div of the Success Message subtemplate.
NB The template change will affect all pages that are based on it, not just Page 2, so you may need to take a copy of it first. You could include the Javascript in the page template so that you don't need to keep adding the same on load Javascript to each page.

How i can create user alerts in Django?

Subj
Several limitations:
Warnings should be specific to each user.
Alerts can also contain links and HTML form (the simplest form
with empty action ="").
Table of Contents Alerts should be dynamic, since it must be
current at all times.
Types of alerts can be extensible.
It remains only to consider how to store it in a database, and generate and transmit to the template.
Examples of alerts:
User <a href="/accounts/64/profile/"> Vlad </ a> commented on your
forum <a href="/forum/topic/54/"> Topic </ a>.
User <a href="/accounts/64/profile/"> Vlad </ a> added to your account to your favorites.
User <a href="/accounts/64/profile/"> Vlad </ a> asks if you add to your favorites.
<form action="" method="POST">
<input type="submit" value="Ok">
<input type="submit" value="No">
</ form>
Anybody can explain how to store it in a database, and generate and transmit to the template?
Sorry for my Engl
You could use, or build on, the Django Messages Framework.
I think you will need to create one more table, where you will keep data about the user who will recieve alert, user who will send alert and template name, where you will keep alert (so you will need to include it in your main template). Also, you will need one or more boolean fields for flagging this alerts.
So, every time user log in or change page you will check this table and show alerts. If there any, you'll display alert block and put flag into False. So, I think you will need more flags, because one flag will check views of this alert, other will check user answer (like last one form) and so on.
I think you should use django-alerts library for Send alerts, notifications, and messages based on events (signals) in your django application
installation of alerts
pip install django-alert
for more information about alert you can try this link DJANGO-ALERTS
for storing it into the database you can create seperate table/collection and there you can generate schema like user recived , user logged in etc.