iMacro: test resulting URL - automation

Using iMacro (chrome extension), I would like to automate an action on a website:
check a checkbox (conditions)
click button (submit)
then compare the resulting url to a string
if true ==> restart script from beginning
if false ==> show a popup message (or anything else Alerting the user)
I started from here after recording steps 1 and 2 which works fine and can run in loop
VERSION BUILD=8350307 RECORDER=CR
URL GOTO=http://websitew.com/5421/0
REFRESH
TAG POS=1 TYPE=A ATTR=HREF:http://websitew.com/5421/0#
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:FormBookingCreate ATTR=ID:condition CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:FormBookingCreate ATTR=NAME:nextButton
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:FormBookingCreate ATTR=NAME:finishButton
Further, it doesn't accept if satement, and I don't know how to inform the user with some kind of messagebox or alert
SET current {{!URLCURRENT}}
#if current = "http://websitew.com/5421/0" then
MsgBox "OK!"
else
"""start from the beginning """

Try this solution for the Chrome 'iMacros' extension:
' here your code with the 1st and 2nd steps '
SET S EVAL("('{{!URLCURRENT}}' == 'http://websitew.com/5421/0') ? 'alert(\"OK!\");' : 'undefined';")
URL GOTO=javascript:{{S}}
' uncomment the line below to stop your macro after a message box '
'SET E EVAL("('{{S}}' == 'undefined') ? '' : MacroError('STOP!');")

Related

How can I test that Browser tooltip is shown?

What do I have:
Laravel 5.5
Laravel Dusk 2.0.14
How can I test (assert) that browser tooltip
was shown, when I'm trying to submit a form without filling required field?
What I've tried:
$browser
->assertSee('Please fill out this field');
But it didn't work.
You can get the message with JavaScript:
$message = $browser->script("return document.querySelector('input[name=foo]').validationMessage")[0];
$this->assertEquals('Please fill out this field.', $message);
Note that the message will always be set as long as the input's value is invalid. This assertion also works before you press the submit button.

WQO agent and LotusScript

I am trying to create a div tag in WQO agent using Lotusscript as below :
In my form it is blank form
Dim session As New NotesSession
Set thisdb = session.CurrentDatabase
Set doccontext = session.DocumentContext
Print | </form> _
<form name ="thisform" _
<form name ="thisform" > _
<div id ="thisform"> _
Please wait while we proces your request ........<img src='./please-wait.gif' width=50 height=50></img> _
</div> _
</form> |
However this outputs nothing, am I doing anythign wrong here ?
Edit :
Basically I wanted to print view html view with button to delete the selected records, but before I want to make sure that please wait is being displayed before it prints HTML view.
As per the help page for WebQueryOpen and WebQuerySave agents, you can't use a print statement in a WQO agent to send HTML to a browser.
A WebQueryOpen event runs the agent before Domino® converts a document
to HTML and sends it to the browser. Domino ignores any output
produced by the agent in this context.
You need to put a field in the appropriate place on the form, mark it as pass-through HTML, and have your WQO agent save the HTML into the item value for that field.

iMacros website form dropdown menu

I'm trying to automate filling a form that reads data from a csv file and inputs the data into the website form in the screenshot below. However, I can't seem to figure out how to get the gender dropdown selection to work correctly.
Screenshot of website: http://i.stack.imgur.com/GZLP3.png
Options for gender dropdown: http://i.stack.imgur.com/ZWr79.png
I am using:
TAG POS=1 TYPE=SELECT FORM=NAME:new_patient ATTR=NAME:gender CONTENT=${{!COL5}}
Where my csv file has the letter "F" (for female) in Column 5. I have tried using % as well. I am currently using the iMacros 10 browser but will ultimately use Chrome as my browser of choice if possible for this.
I believe this code will work:
SET option EVAL("switch ('{{!COL5}}') {case 'M': s = 'Male'; break; case 'F': s = 'Female'; break; case 'U': s = 'Undifferentiated'; break; default: '';}")
TAG POS=1 TYPE=SELECT FORM=NAME:new_patient ATTR=NAME:gender CONTENT=${{option}}
...or just so:
TAG POS=1 TYPE=SELECT FORM=NAME:new_patient ATTR=NAME:gender CONTENT=${{!COL5}}*

Save dialog not able to Interact - Selenium Webdriver with Java

before, i'm new for this AutoIT, i'm not familiar with this, just google and need to complete my task, if any mistake of my AtotoIt please correct it
scope:
during the Xml Download from IE(version 9) it will open the "Do you want to open or save dialog" so i want to click the save button to save that xml file in default temp folder
my autoIT code(reference from http://qtp-help.blogspot.in/2009/07/selenium-handle-dialogs.html#handle_save_dialog)
AutoItSetOption("WinTitleMatchMode","2") ; set the select mode to select using substring
if $CmdLine[0] < 2 then
; Arguments are not enough
msgbox(0,"Error","Supply all the arguments, Dialog title,Run/Save/Cancel and Path to save(optional)")
Exit
EndIf
; wait Until dialog box appears
WinWait($CmdLine[1]) ; match the window with substring
$title = WinGetTitle($CmdLine[1]) ; retrives whole window title
WinActivate($title)
If (StringCompare($CmdLine[2],"Open",0) = 0) Then
WinActivate($title)
ControlClick($title,"","Button1")
EndIf
If (StringCompare($CmdLine[2],"Save",0) = 0) Then
WinWaitActive($title)
ControlClick($title,"","Button2")
; Wait for the new dialogbox to open
EndIf
If (StringCompare($CmdLine[2],"Cancel",0) = 0) Then
WinWaitActive($title)
ControlClick($title,"","Button3")
EndIf
My java code
WebElement downloadLink = driver.findElement(By
.xpath("(//img[#alt='Download'])[3]"));
downloadLink.click();
Thread.sleep(4000);
dialog = new String[] {
"C:\\Users\\Prabakar\\Desktop\\Save_Dialog_IE.exe", "Save" };
Runtime.getRuntime().exec(dialog);
Please help to solve
Take a look at other ways to download the file without using AutoIT.
How to make browser closed after completing download?
#include <_XMLDomWrapper.au3>
#include <File.au3>
Global $oXML = ObjCreate("Microsoft.XMLHTTP")
$oXML.Open("GET", "YOUR URL LIKE: http://www.google.com", 0)
$oXML.Send
Global $sFile = _TempFile(#TempDir, '~', '.xml')
FileWrite($sFile, $oXML.responseText)
Would this work for you? The XMLDomWrapper.au3 can you get from HERE
Source

IE automation send the HTTP Post directly to the form action using VBA

I am having some automation trouble.
I am using HTML Object Library to automate an download. At the end of the automation process, I have to click a submit button of a form and then the download starts.
When I try to handle the dialog with the winapi32 function like this:
hWndDialog = 0
'Wait until the dialog is open
While hWndDialog = 0
hWndDialog = FindWindow(vbNullString, "Dateidownload")
Wend
'get the handle of the button
hWndDialogSpeichern = FindWindowEx(hWndDialog, 0, "Button", "&Speichern")
Call SetForegroundWindow(hWndDialog)
'send message
lRetval = SendMessage(hWndDialogSpeichern, &H5, ByVal 0&, ByVal 0&)
Nothing happens. I read something, that this isn't possible, because the dialog is modal?
So I try to send the POST data directly to the form's action. I think this is the best possibility even.
But I don't know what to send to the server.
Here the form in the html page:
<form action="/smarti/bismt/bismt/resexport" method="post">
<input class="active" type="button" onclick="submitform()" name="button_export" value="Export">
submitform() only check some values and then calls:
document.forms[0].submit();
However, when I send a POST request to "/smarti/bismt/bismt/resexport" I only get the page. I don't know how to set up the request header. Tried to use firebug, to see what is sending to the form, but saw nothing I recognized.
Did you try adding a question mark ? and then the names of the text input boxes? Like http://zip4.usps.com/zip4/zcl_3_results.jsp?zip5=92101.