Is it possible to simulate a click on the start button without saying /start ?
This button simply sends a message with "/start" as the text to the bot, which can be done with client.send_message:
client.send_message(bot, '/start')
If it has parameters add them after a space:
client.send_message(bot, '/start argument')
Raw API also has messages.startBot which offers some more flexibility and I believe hides the start message.
Related
I am using Botium Box crawler on a Watson Assistant skill.
The bot's initial statement includes a greeting and seven buttons.
Botium is generating test cases for each of the buttons, but the button-press does not generate the right response in Watson Assistant.
A generated case is below:
1.6.2.2.2.4_hello_Password
#bot
#me
hello
#bot
UTT_M1_HI-THERE!
#bot
BUTTONS Benefits|Badges, Explanation of Badges or Certificate of Completion|COVID-19|ID Cards - Order, View, Print, Return|Employment/Termination|Password|None of the above, enter search text
#me
BUTTON password|Password
#bot
(responds as if Watson Assistant received the word "BUTTON" rather than the "password" value in "Password"-labeled button)
The dialog node has child responses using conditions like:
input.text=="password" or input.text.contains("password")
The expected behavior in Watson Assistant for a button press is that the button text (not label) is passed to the button. In the Watson Assistant Try it Out panel I click "Password" and it sends the text "password".
The only way I can replicate the Botium behavior in Try it Out is to pass the literal text "BUTTON". Even if Botium sent input.text=="BUTTON password|Password" my condition should fire.
Am I using Botium Box crawler wrong, or is there a bug in the crawler?
Update: Other button-driven prompts work, such as "yes/no" button prompts. I wonder if there is a parsing problem because the buttons have very long labels with some special characters and punctuation.
The issue has to be fixed with the next release of the crawler package.
If you need this fix now, then we can update directly your trial instance.
You can get more detailed log by set the DEBUG=botium-* env variable. So in commandline it should look like this:
DEBUG=botium-* botium-cli crawler-run --entryPoints 'hello'
In this case you will get a log and very detailed log. You can reduce its size with using exitCriteria (e.g.: --exitCriteria 'Benefits' 'Badges') to exclude those path which work correctly.
We will investigate the detailed log, just send us please.
I want to find and click a button using Autoit. I tried AutoIt Window Information Tool but the button is not recognized so ControlClick() fails.
The button is active on the current window but Send("Enter") does not work. Tried using MouseClick() but the window does not appear in the same place every time, and I tried this script:
$hWnd = WinWait("vcredist_x86")
WinWaitActive("vcredist_x86")
ControlClick($hWnd, "", "[CLASS FROM AUTOITINFO]", "Left", 1)
but neither of them works. Is there any other way to identify and click the button?
If both version of AutoItWindowInfo(32 and 64bit) don't "see" the control you need to automate, here is what you can do:
Method 1 - Sending keystrokes:
Activate the window with WindowActivate
Send a number of TABs until the control is focused(if its not initially)
Send ENTER or SPACE
Method 2 - MouseClick:
Activate the window
Get the coordinates of a control relative to the application window(position the window at 0,0. Open Autoit Window Info, click on Mouse tab and get the position of the button). That position is usually always the same
When your code is running it must get the window position with WinGetPos and then add control position you got in step 2. That's your clicking position.
Method 3 - PixelSearch(If the control has unique color):
Get the desired color with AutoIt Window Info(mouse tab)
Search it using PixelSearch
Click the coords you got
Method 4 - ImageSearch:
Get ImageSearch UDF and DLL
Make a picture of the button
Search and click it
NOTE: Sometimes you need to give your script Admin rights in order to automate certain windows.
When AutoIt Window Information Tool failed me I had success using the text property of the button/ui control:
ControlClick($hwin, '', '[CLASS:Button; TEXT:Cancel]')
Experiment with "&" in front of one of the characters (underlined by Windows to indicate an Alt + key shortcut), so try "&Cancel" instead of "Cancel". If that fails try ControlFocus() first:
ControlFocus($hwin, '', '[CLASS:Button; TEXT:Cancel]')
ControlClick($hwin, '', '[CLASS:Button; TEXT:Cancel]')
Inspecting .exe files for GUI resources (using Resource Hacker for example) may expose text/properties of a control. Example:
I am trying to build a bot that sends messages which embed a couple of standard replies which can be sent just by tapping on them.
Each link would contain a space - e.g. "/ack 20134" & "/pass 20134"
So tapping on the first link causes the text "/ack 20134" to be sent back to the bot.
How do I embed this into the message that I send from the bot to the client in text, HTML or Markup?
set that element (button text for example) text field to "/ack 20134" .Then when user hit the button this command will send to your bot. you can use inline keyboards and set its data incallback_data to this value. But you cannont use it a text message because space separates two fields(embeds just "/ack" i.e. command part. user can hit it but your bot just receives "/ack".)
For text messages there is another option: do not use space(e.g. "/ack20134" without space) and your bot's would receive "/ack20134", then you must parse commands part)
I meet a stranger question,when I read the android GlobalAction source code,I find that it will start a dialog,but it add a judgement which will judge whether this dialog has been shown,if it was shown before,it will be dismissed and then show it.The stranger things is that it dismiss the dialog,than use Handler to send a message to create and show dialog again,I can't understand why it needs to send a handler message,I think it just calls dialog dismiss function.then calls show function,it no problem.The comment said:"Show delayed, so that the dismiss of the previous dialog completes",but I also can't understand the meaning,please someone help me explain it,Thanks a lot.
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
// Show delayed, so that the dismiss of the previous dialog completes
mHandler.sendEmptyMessage(MESSAGE_SHOW);
}
Many Android UI functions are themselves implemented using messages, and so do not complete immediately. When you call Dialog.dismiss(), Android queues a message that does the actual dismissing. The author of this code wants to ensure the dialog is actually dismissed before showing it again, and so she posts her own message, which will not run until after the one posted by Android.
I have a small requirement..
if the user dint sign off or log off then he try's to close the browser IE clicking on 'X' (top right of IE or Firefox browser ) then i need to ask a conformation message like "Are you sure you want to close ?" ...
I am using Master page in my application and i tried the event : "window.onbeforeunload " in my master page its works fine, shows an alert(conformation) message. but if i press back button on the browser(IE on IE or Firefox) then also its firing(but it should not) is there any way to full fill my requirement ..I hope i had explained u clearly...if not pl z let me know........
what i mean to say is.. if the Session("USerid") is active or if it contains any value ie.
Session("USerid")="XXX"
at that moment if user trys to close the browse(click in 'X'/Close button browser either IE or Firefox ) it should give prompt a message "are u sure do u want to close?"..
Its all about design steps - but the close and the back button is the same, the close the page, so maybe its impossible to have them all together.
To open, close your script you can make a simple trick. Place them inside a literal and open or close it.
<asp:literal run="server" id="txtCloseAlert">
<script>
... you code here ....
</script>
</asp:literal>
and on code behind.
txtCloseAlert.visible = !string.IsNullOrEmpty(Session("USerid"));
I've looked into this recently and there does not appear to be a standard / consistent way to do this cross-browser hence you back-button problem.
On IE at least you get an event object passed as a parameter to the onbeforeunload method that you can use to get the mouse position, but in FireFox you don't and you would need some other way to determine whether a confirmation is required. It is quite posible that you could get the mouse position in some other way as I haven't looked into that. Point is that if your mouse is not on your form you probably want a confirmation.
You can look at this SO question:
Prevent browser from closing in asp.net
Or do an Internet search on 'onbeforeunload prevent browser closing'.
In your case a synchronous ajax call can be made to the server to do the test.
HTH