winappdriver get Data from System.Data.DataRowView - c#

I am writing an UI Test for a Windows Forms application, up untill now I was able to extract the nessesary information for the Tests with the Windows Kit inspect tool
The Inspector Tool
now my problem is, I got the following list, but I cant get the text of the list item. Normally the text of an element is the property Name but in this list its just "System.Data.DataRowView"
The List in the UI
for anyone corious, this is how im getting the element (C#)
WindowsElement element = driver.FindElementByName("System.Data.DataRowView");
and this is how it looks like in the Debugger:

Just found out it is not possible, this issiue on the github repository describes it:
https://github.com/microsoft/WinAppDriver/issues/1475
The only workarounds are screnshoting and extracting the Text with OCR

Related

How do I print a TextFile OR contents of a TextBox in Metro apps?

I have a TextBox control in my Metro app and need to be able to simply print its contents. I have done my research ever since Windows 8 Dev Preview was around and I still cannot figure it out.
I've tried samples, read other answers and read the documentation - over, and over, and over. It just doesn't seem possible. So, after what, 2 years? I'm offering all my reputation (well, as much as they'll allow) in the hopes that someone can help me.
Here I have created a simple helper class which help you to print the Textbox content with its formatting. You just need to call static method of class Printer. The project on GitHub also contain test app.
await Printer.ShowPrintUIAsync(PrintPreview, MyTextBox, Guid.NewGuid().ToString());
PrintPreview is a canvas, which is mandatory to show print preview in device charm. You have to declare in your XAML.
MyTextBox is a text box object, whose text content is going to be printed.
Guid.NewGuid().ToString() is a file name for printing the document. (It will be applied if you are creating PDF or XPS file via printing.)
You can add helper class via NuGet. If you want to enhance my existing helper class, fork on GitHub

Web automation using C# WebBrowser

I'm in the very early stages of attempting to automate data entry and collection from a website. I have a 16,000 line CSV file. For each line, I'd like to enter data from that line into a textarea on a webpage. The webpage can then perform some calculations with that data and spit out an answer that I'd collect. Specifically, on the webpage http://www.mirbase.org/search.shtml, I'd like to enter a sequence in the sequence text box at the bottom, press the "Search miRNAs" button and then collect results on the next page.
My plan as of right now is to use a C# WebBrowser. My understanding is that I can access the individual elements in the HtmlDocument either by id, name or coordinate. The last option is not ideal, because if I distribute this program to other people I can't be sure they'd be using at the same coordinates. As for the other 2 options, the textarea has a name, but it's the same as the form name, so I don't know how to access it. The button I'd like to click has neither a name nor an id.
Does anyone have any ideas as to how to access the elements I need? I am by no means set on this method, so if there's an easier/better way I'm certainly open to suggestions.
The WebBrowser class is not designed for this, hence why you are coming up with your problems.
You need to look into a tool that is designed for web automation.
Since you are using C#, Selenium has a wonderful set of C# bindings, and it can solve your problems because you'll be to use different locators (locating an element by a CSS selector or XPath specifically).
http://docs.seleniumhq.org/
Check mshtml - Mshtml on msdn
You can use it with the WebBrowser object.
Add Microsoft.mshtml reference to your project and the using mshtml declaration in your class.
Using mshtml you can easily set and get elements properties.

Can you Create a Keynote using the Revit API in C#

I'm trying to create a Keynote Tag via the Revit 2012 API. However, I found now reference to creating a Keynote Tag anywhere on the internet or in the samples. I see that the BuiltInCategory.OST_KeynoteTags is part of the IndependentTag class and according to http://thebuildingcoder.typepad.com/files/guide-to-placing-family-instances-with-the-api.doc you need to use the TM_ADDBY_CATEGORY TagMode to create a Keynote. However, when you then try to change the new Tag via ChangeTypeId, you get an error.
Has anyone figured this out?
I haven't had a chance to try yet, but I'm thinking you're out of luck.
For the most part, you can't do things with the API that you can't do interactively in Revit. I did quickly test that you can't change the type of a multi-category tag to be a keynote tag.
While they're both IndependentTag elements, they are different Categories, and it's very rare in my experience where you can switch the category of a placed element.

XMLParseException when searching with tmdb c# api

I am trying to access movie info using themoviedb API as imdb seems like a lost cause.
They use a key which I replaced with *'s but from what I can see this should be all I need to do a simple search
so my code is very simple
TmdbAPI api = new TmdbAPI("***************************");
TmdbMovie[] movies = api.MovieSearch(batman);
But whenever I search I get the XMLParseException unless I outcomment the second line
There is a sample application, but I cant get it to run with VS2010 and I cant see how its doing the things any differently except that app reads the name of the movie from a textbox as mine will further down the road.
Looking at the issue tracker, there appears to be a problem with the returned XML since December 1st 2010 (if not earlier).

WPF Binding and Using Custom Sample Data in Visual Designer

Quick 1 sentence summary: I wrote a demo app [download src here][1] that doesn't properly display sample data in the Visual Studio Designer and I need help.
After 6+ years developing in C# and WinForms, I've decided to use WPF in my current project. I've written a small demo application to teach myself and experiment with WPF (you can see a screenshot [here][1]). The app simply downloads and displays recent news stories from the Google News RSS feed.
My first attempt at this resulted in the class called "GoogleNewsWidget." After reading about the MVVM model, however, I tried again and built "GoogleNewsWidget2" that attempts to utilize a more MVVM-oriented architecture. I'm not sure which implementation is best as they both seem to be working fine on the whole (and though I'd appreciate comments on which is better, it is not my primary question).
My main problem is that neither play very well with the Visual Studio Designer. The GoogleNewsWidget2 loads and displays data fine when its xaml is opened directly but does not display correctly when embedded into another xaml file . The GoogleNewsWidget does not display data in the Designer in either case.
Any help would be appreciated. Again, the source is available for download [here][1].
Thanks,
Jon
[1]: http://abstract.cs.washington.edu/~jfroehli/reflect/ Demo App Source Code
PS My original post had multiple hyperlinks to screenshots but its posting was denied by StackOverflow for spam prevention reasons. Thus, I created the [1] url, which contains screenshots and a link to source code. If someone could also help me figure out how to use the "Markdown" language for linking, I'd be grateful. :)
Assuming that the VS2010 designer works the way Blend 3 does, you have to provide "dummy" data -- the designer won't pull data from external sources.
Create an object that implements the same interface as your datasource (view model) and fill it with static data. Make sure it has a public, no-arg constructor.
Define it as a resource in your control, giving it a key like "DesignData".
In the root element of your control, add the attribute d:DataContext={DynamicResource DesignData}"
This will be used as the DataContext only when in the designer.

Categories