Spying Elements in Blue Prism - HTML - element

I am attempting to spy elements of a web page in Blue Prism however I am getting the below error message.
System.ApplicationException: Interface not registered (Exception from HRESULT: 0x80040155)
at BluePrism.AMI.clsAMI.Spy(clsElementTypeInfo& elementType, List`1& identifiers)
at Automate.frmIntegrationAssistant.HandleSpyOrLaunchClick(Object sender, EventArgs e)
please can someone assist?
application is set to (Browser Based Application)
App Mod does attach successfully

On which mode are you trying to spy?
Go for accessibility mode. That might help.

Web application -> html mode use for spy elements and now recheck again and do spy elements as html mode (ctrl+left button)

Related

Appium can't scroll in Android App when starting on clickable element

My situation
I want to write UI-tests for an Android App and therefore I need to scroll in some of the App's fragments. The tests are written in Kotlin, Appium version is v1.15.1 .
My problem
I use the standard approach for scrolling(see below) and it works fine, as long as the coordinates of my starting point don't fall onto a clickable element. I also observed this behaviour when navigating through the App with the Appium Desktop Inspector.
My current approach
PlatformTouchAction(driver as AppiumDriver)
.press(PointOption.point(100, 500))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000)))
.moveTo(PointOption.point(100, 100))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000)))
.release()
.perform()
As mentioned before this works if the starting point (100,500) is not on a clickable element.
If for example a button happens to be at (100,500) the scroll/swipe is not performed, but in fact on scroll listeners are still called.
You can scroll with help of resource id of element. This can be achieved with UiAutomator2 as automation engine. You need to use automation name as UiAutomator2 in desires capabilities.
Add in desired capability UiAutomator2 if you are using appium as automation engine.
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
Now use below functions if you have element's resource id, and index as 0 if there is one element on page.
public void scrollByID(String Id, int index) {
try {
driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().resourceId(\""+Id+"\").instance("+index+"));"));
} catch (Exception e) {
e.printStackTrace();
}
}
This is dynamic approach it will scroll till element is not visible.

Handle button click in Xamarin Forms Android to Navigate to new page

I am trying a simple Android app using Xamarin Forms with C# for the coding. In my Main.axml there's a button, on clicking which I'd like to go to a new page, say XInfo.axml.
Now this is my MainActivity.cs:
using System;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Xamarin.Forms;
namespace AlberoPizza
{
[Activity(Label = "Albero Pizza", MainLauncher = true, Icon="#drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button btn = FindViewById<Button>(Resource.Id.MyButton);
btn.Clicked += (object sender, EventArgs e) => {
};
}
}
}
Now, I am finding it difficult to structure code inside my Lambda which would handle the navigation to the page, whose name I mentioned. There is no Navigation Bar and there cannot be any navigation bar. Also, for the existing code block, I am getting this error, which is quite weird to me:
Error CS0311: The type 'Xamarin.Forms.Button' cannot be used as type parameter 'T' in the generic type or method 'Android.App.Activity.FindViewById(int)'. There is no implicit reference conversion from 'Xamarin.Forms.Button' to 'Android.Views.View'. (CS0311) (AlberoPizza)
I thought this is how we usually find controls in Android app Xamarin. Can you help me complete the code for this? I'm sure it's a pretty basic type of scenario. There is this persistent error on the one hand and the code to navigate to XInfo.axml on the other. I've tried stuff like Activator.CreateInstance, the PushAsync, etc. inside the lambda, but more errors show up and entire thing becomes more and more complicated.

Change opacity of a TreeItem

I have a server and client using gwt.
In my client page i have a tree item displayed.
I want to do one of the following:
- disable the tree item when a function is called.
- made opaque the entire client page or only the tree item when a function is called.
By made opaque, i want to do the same as occur when i debug my project with eclipse and i stop and i get the following in the client page
GWT Code Server Disconnected
Most likely, you closed GWT Development Mode. Or, you might have lost network connectivity. To fix this, try restarting GWT Development Mode and REFRESH this page.
Please give me some indication on how to do it and if it is possible.
you create a handler for you function call(s) and add the style when the funciton is called. Because GWT works with javascript it changes your appearance during runtime.
item.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
event.getItem().setStyleName("newStyle");
}
});
and in the css you define you style:
newStyle: {
...
your style definition
}

ASP.NET Button Click event does not appear to fire

I'm relatively new to ASP.NET. I have a ASP.NET MVC 2 Web Application project (created in Visual Studio 2010). I added a method to HomeController called Search
public ActionResult Search()
{
return View();
}
and created a corresponding view (web page) called Search.aspx onto which I dropped a button. I double-clicked the button to add a handler for the button click event which sets the text of a TextBox, then built the application.
<script runat="server">
protected void MyButton1_Click(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Undo button clicked");
m_search_text_box.Text = "MyButton1_Click";
}
...
When I click the button in my browser (I tested in Chrome and Internet Explorer), nothing happens. The text box is not updated. Nothing is written to the Output window either. So, it doesn't look like the event is firing. Can anybody offer any suggestions? I'm using Visual Studio 2010 on Windows 7.
Thanks
You are mixing WebForms event handling into an MVC app. MVC does not work like WebForms. Check out the tutorials on MVC2 to help get you started down the right path.
Here's a sample app with step by step tutorials to help get to the basics of MVC down.
ASP.NET MVC doesn't use code behind handlers like that. You use controller actions to respond to requests, and decide how to visually handle them (ie: you can render a view, or return a JSON object, or redirect to another Action etc).
In your instance, if you want to put some text in a textbox after the user has clicked the button, you'd want to put a Submit button in a form, and create a controller action to respond to it:
[HttpPost]
public ActionResult Search()
{
var model = new SearchModel();
model.StatusText = "MyButton1_Click";
return View(model);
}
In your view, you want to use this model, and put its StatusText property value into a textbox:
<%= Html.TextBoxFor(x => x.StatusText) %>
Have a look at the ASP.NET MVC website which has a lot of great getting started tutorials, and the Nerd Dinner tutorial (a free chapter in the book).

I have a VSTO application as an add-in to MS Word and I want to set keyboard shortcuts to the ribbon buttons

When I developed this app (in C# Visual Studio 2008) I asked the same question (actually managed to find an answer on the MS forum, for which I deserve a prize of some sort). The answer from MS was that the only way to set keyboard shortcuts to your own methods is to write a macro which invokes the method (via COM. obviously) and set the shortcut to invoke that macro.
This is really not the answer I want to hear. VSTO makes it possible to build a really nice application with very good use of the ribbon, etc., but then you have to go to the trouble of exposing the entire thing through COM and build another interface into it via the macros. Which, in addition to being a waste of time, totally circumvents all the security that MS have built into support of VSTO Add-ins.
My question is: Is this really necessary (the whole COM/macro thing), or is there a way that I can assign a keyboard shortcut to my own ribbon items? Word 2007? Word 2010?
Thanks
Its too late to answer but worth sharing.
I have used Keyboard shortcuts in my project. Basically this shortcut key should bring a WPF form called SignOff. This WPF form can be displayed either by clicking a button in from the ribbon tab or by using keyboard shortcut(Ctrl+ Shift +S).
There are four places where I need to write my code.
The action method for the ribbon button called on click event.
public void btnInsertSignoff_Click(IRibbonControl control)
{
InsertSignoff();//This method displays the sign off form
}
The following code binds a key board shortcut with VBA code in the Addin Startup / Document Change event
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Globals.ThisAddIn.Application.KeyBindings.Add(WdKeyCategory.wdKeyCategoryCommand, "InsertSignOff ", Globals.ThisAddIn.Application.BuildKeyCode(WdKey.wdKeyControl, WdKey.wdKeyShift, WdKey. wdKeyS));
}
This link shows how to call VBA Code using Keyboard shortcuts.
http://www.wordbanter.com/showthread.php?t=31813
I followed this example but instead of VBA I did that in VSTO Addin Startup event but the second parameter " InsertSignOff " is a VBA method in step 4.
Wrote another method called InsertSignOff (Following exposing VSTO method to VBA).
[ComVisible(true)]
public interface IAddInAdapter
{
void InsertSignOff ();
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class AddinAdapter : IAddInAdapter
{
public void InsertSignOff()
{
InsertSignoff();//This method displays the sign off form
}
}
This link explains how to expose VSTO code to VBA
http://msdn.microsoft.com/en-us/library/bb608604.aspx
Created a .dotm file in the user templates location “C:\Users\\AppData\Roaming\Microsoft\Templates” which contains the following VBA code
Sub InsertSignOff ()
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("Wordaddin.AddinAdapter")
Set automationObject = addIn.Object
automationObject.InsertSignOff
End Sub
Hope this helps some one.
You can use the global key hook up method mentioned over here: https://learn.microsoft.com/en-us/archive/blogs/vsod/using-shortcut-keys-to-call-a-function-in-an-office-add-in