how to access elements not read by FlaUI using UIA2 or UIA3? - automation

How to access/Find elements not read by FLAUI using UIA2 or UIA3?
since FLAUIInspect does not show up any of the available element under the window (while inspect.exe shows all available elements) FindAll (Children/Descendants) will not give any element.
is there a wat to get these elements using FLAUI??

First, you have to access the element you need to see. On your case, the ""pane it's a Control Type Panel inside the main window, so you gonna have to do something like this:
var automation = new UIA3Automation();
var app = FlaUI.Core.Application.Attach(application.Process.Id); //Here you can attach or start a application by path
var window = app.GetMainWindow(automation); //Get hold of the window
var allObj = window.FindAllChildren();
var panel = allObj.Where(x => x.AutomationId == "16386096").FirstOrDefault().FindAllChildren(); //Here you can use other property unique to the panel, I used the AutomationId for example
After you get hold of the panel, you can now find all the children objects.emphasized text

You need to expose the AutomationPeer for that element which is not being found by FlaUI

Related

How do I use Selenium Drag and Drop one a webpage to an iframe

I am working on a test, where I am trying to utilize drag and drop to drag the 'Text' from grapejs editor into the Frame, where we enter in our content.
I first tried to move the element from one element to the other, but I noticed that the second element was within an iframe, so I tried to use the x, y coordinates. But of course, the XY coordinates are (0,0) within the frame. So the element was out of range. I also tried the 0,0, but also said it was out of bounds.
var target = Driver.Instance.FindElement(By.XPath("//*[#id='gjs']/div[1]/div[2]/div[5]/div[2]/div/div[1]/div[1]/div[2]/div[5]"));
var builder = new Actions(Driver.Instance);
var action = builder.ClickAndHold(target);
builder.Build();
action.Perform();
var iframe = Driver.Instance.FindElement(By.TagName("iframe"));
Driver.Instance.SwitchTo().Frame(iframe);
builder = new Actions(Driver.Instance);
var destination = Driver.Instance.FindElement(By.XPath("/html/body"));
action = builder.MoveToElement(destination);
builder.Release(destination);
builder.Build();
action.Perform();
Has anyone successfully used Selenium to Drag and Drop across to an iframe lately? All the examples are old...maybe there is a new way to do it. All the examples say use the offset, but putting what I think is the offset for that iframe in the page is not working, nor is switching to the iframe, and setting the co-ordinates within the frame.

Can HTAs be used to automate web browsing?

I am new to HTAs. I just read https://msdn.microsoft.com/en-us/library/ms536496%28v=vs.85%29.aspx and am a bit confused.
Can I use HTAs to automate browsing? Say I want to download a web page and fill in a form automatically, i.e. from a script. How would an HTA help me do this, if at all? It's important that the JavaScript code in the downloaded page is run as usual. I should be able to enter somehow and fill in the form after it has finished initializing, just as if I were a human agent.
First, you need to open an IE window, as follows:
var IE = new ActiveXObject("InternetExplorer.Application");
Then navigate the IE window to the webpage you want:
IE.Navigate("www.example.com");
Wether your IE window is visible or invisible, it's up to you. Use Visible property to make it visible:
IE.Visible = true;
Then, you should wait until the webpage is completely loaded and then run a function that takes your desired actions. To do so, first, get the HTML document object from the webpage using Document property of IE object, then repeatedly check the readyState property of document object. In the code below, it is assumed that you have a function named myFunc, which takes your desired actions on the webpage. (For example, modifying the contents of the webpage.)
var doc = IE.Document;
interval = setInterval(function() {
try
{
if (doc.readyState == "complete")
{
myFunc();
clearInterval(interval);
}
}
catch (e) {}
}, 1000);
In the function myFunc, you can do anything you want with the webpage since you have HTML document object stored in doc variable. You can also use parentWindow property to get the HTML window object.

Dojo Dgrid - Events in Configuration

I've been looking into dgrid and I'm trying to figure out if there's a way to attach an event to a grid that uses dojo/on without explicitly calling grid.on but, instead, passes it as a method (or set of methods) in the initial configuration of the grid. The reason for this is because the grid instance itself out of scope upon creation and I can't find any documentation on it.
So, instead of
var grid = new (declare[Grid])({}, element);
grid.on('.dgrid-row:click', function(){console.log('Hello World!')});
having something like
var grid = new (declare[Grid])({
'events' : {
'.dgrid-row:click' : function(){console.log('Hello World!')}
}
}, element);
Ideas? Alternatives?
You can use the the DijitRegistry extension, which will allow you to get a reference to your grid like you would with a normal dijit widget, through registry.byId... then you can use grid.on, as usual.
Example : https://github.com/SitePen/dgrid/wiki/DijitRegistry

XPages: Dynamically populate Navigator Control

I need to create links of available views in database on Navigator Control. I did not find any computed formula area for that control. Just like we use code for combobox:
var v = database.getViews();
var a = []
for(var i=0; i<v.size(); i++) {
a[i] = v[i].getName()
}
return a
After achieving that, the select view will display by Dynamic View Panel of ext library.
Please guide me how to do this. Thanks in advance.
-MAK
You can create a navigation entry for each view in you database using the <xe:repeatTreeNode> in the <xe:navigator>:
<xe:navigator id="outline" expandable="true">
<xe:this.treeNodes>
<xe:repeatTreeNode loaded="true" indexVar="index" var="crrView" value="#{javascript:return database.getViews();}">
<xe:this.children>
<xe:basicLeafNode label="#{javascript:crrView.getName();}" loaded="true">
</xe:basicLeafNode>
</xe:this.children>
</xe:repeatTreeNode>
</xe:this.treeNodes>
</xe:navigator>
This code will generate a in you navigation for each view in your Database. You can use the variable crrView in the <xe:basicleafNode> to get current element of the Vector returned by database.getViews() in the loop.
You can also use other elements then the <xe:basicLeafNode> in the <xe:repeatTreeNode>.Select the RepeatNode in the NavigationItems window of the navigatior control and click on add Child.

Problems with adding/removing ContentPanes in AccordionContainer

I'm a complete newbie at Dojo, and Adobe AIR, which is my target. I'm
trying to put some panes into an AccordionContainer like so:
var mainview = dijit.byId("mainview");
var rand = randomString();
var widg = gtd_create_entry_widget(rand)
air.trace(mainview);
air.trace(widg);
mainview.addChild(widg);
"mainview" is my AccordionContainer, and gtd_create_entry_widget() is:
function gtd_create_entry_widget(id) {
var entry = new dijit.layout.ContentPane();
entry.attr("id",id);
entry.attr("title","title "+id);
return entry;
}
The pane shows up in the container, with the correct id and title, and
no errors, however, if I try to add another pane, the next one shows
up too, but I get the error:
TypeError: Result of expression '_7' [undefined] is not an object.
I get the same error if I run
var mainview = dijit.byId("mainview");
mainview.destroyDescendants();
and also, only one pane is destroyed at a time, and I understand this
method should destroy all the children.
I can include full project code if required.
Thanks a lot
Garry
I'm not exactly sure if this is going to fix your problem, but you're supposed to use dijit.layout.AccordianPane (http://www.dojotoolkit.org/api/dijit/layout/AccordionPane.html) with the AccordianContainer.