Accessing HTML DOM Object from WINRT Webview control - windows-8

I have found how to load the local html page in Webview XAML Control
Visit winrt: load local html and its resources in webview
What i am unable to find is how to access the HTML DOM Object of the Webview Control
I am developing a C# metro style windows 8 application,i want to capture the user signature,since there is no control yet in winrt xaml for that,i am trying to do that using JQUERY
My SignatureCpture is loaded in the webView,after the user has finished signing i need to read the signature,for which i have to access the HTML DOM of the WebView
I have some hidden field in the Page,i need to use document.getElementByID('') to get the value and store it in database

please refer to this sample code in MSDN Code Gallery: XAML WebView control Sample. In the 5th scenario, it demonstrates how to access the html dom.

Related

Populate the device data contents from thingsboad on mobile?

I have this device data that are shown in real time using ThingsBoard.
And I have an iframe to show the device data content on a web page.
If I used the same iframe on my ionic app's HTML page, I am getting all the header, submenu and other unnecessary things that are not needed in the app.
What I need is the main content area of the device data section.
Can I do that with the iframe or do I need to call all the individual ThingsBoard API's to populate the dashboard on my own?
If you are managing the Thingsboard then you can develop custom iframes with unnecessary headers/footers removed. Then you will get clean iframes to display inside your Ionic app.
In case the Thingsboard is not managed by you then you have to develop adapters to scrape the html data from the Webpage. These adapters will provide your Ionic app only the data you require.
You can use PHP Simple HTML DOM Parser for implementing these data scraping adapters.
PHP Simple HTML DOM Parser

how to find element through appium when The UI Automation View don't provide element information

I am unable to identify element using xpath. The UI Automation View don't provide the element detail information.
I want to click the link on the email content.But there is no link element information.
Please help me. I am struck here.
UI Automation screenshot:
Below is the page source:
Switch the context for handling webview autoamation.
driver.context("WEBVIEW"); //replace with your webview context
Try accessing using the x-path, css, class or simply by
findElement(By.id("message_content"));
You need to use chrome browser for inspecting the web view embedded in Android application. Official doc here
However, there might be a slight issue related to your problem. The thing is to debug a web view embedded in Android application, the web view itself should allow debugging. i.e. the web views object element needs to be changed in the source code. **cached reference here, they have not mentioned this in the updated document.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
WebView.setWebContentsDebuggingEnabled(true);
}
I am not sure if the email application has this enable or not. If you have the source code update the object as mentioned in the snippet.
Use chromes adb plugin to view the web view elements and to perform actions in web view use switch to context , after performing your actions in web view switch context back to native view

Error When Source Artribute is Used in Frame Tag

I am trying to open a webpage in Windows 8 XAML with the following Frame Tag.
<Frame
Source="http://medievaltvg.freeoda.com/"
/>
I get the following error from Visual Studio:
Unknown member 'Source' on element 'Frame.'
The compiler tells you, that there is no member Source on the Frame-control.
This is not what Windows.UI.Xaml.Frame is intended for.
From MSDN.
You use the Frame control to support navigation to Page controls. You create
as many different pages as needed to present the content in your application
and then navigate to those pages from the frame. To navigate from the frame,
you call the Navigate method and pass in the type of the page to navigate to.
You can also pass in a parameter object to initialize the page to a particular state.
What you are looking for is the WebView-Control.

display html in xaml

I wasted few hours for looking the answer and I'm very sad cause I didn't find anything usefull. I have a CMS in cloud and it provides content for diffrent devices like www site and my new windows store application.
I want to use html formating. I've already created app in c# and xaml and I'm wondering how can I display html
I was happy cause I found http://nuget.org/packages/RichTextBlock.Html2Xaml but I can't make it work. I get blank page. No text, no error, no nothing.
Can someone pls tell me how can I display html in my app ?
Use a WebView/WebViewBrush or use HTML Agility Pack and implement the styles/rendering yourself.
In WinRt app you can display html code by some ways:
Using WebView with it's NavigateToString("html content")
Using WebViewBrush and displaying it in rectangle
If you had your .html file local - you can open it with myWebview.Navigate(new Uri("ms-appx-web:///" + myPath));
You can make a screenshot of webpage by the method wich I describe here and open it as a picture.
For more info, see the WebView control sample

Can I get the current HTML or Uri for the Metro WebView control?

It doesn't appear that the Source property for the XAML WebView control is updating as the user is navigating in the WebView. Is it possible to get either the current Uri or the HTML currently being rendered in the WebView? My need is to parse the HTML that is being displayed so either would work.
Turns out that the WebView doesn't provide a way to retrieve its HTML directly. But you can use WebView.InvokeScript like this:
webview.InvokeScript("eval", new string[] {"document.documentElement.outerHTML;"})
You can also obtain the Uri via the LoadCompleted event's NavigationEventArgs.Uri.
Did you look at the LoadCompleted event for WebView? That gives the URI that's just loaded.
The property you are looking for is called Source.
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.source.aspx
Unluckily the Document property of WinForms WebBrowser doesn't seem to exist anymore.
You will have to re-download the page and process it using libraries like HtmlAgilityPack and Fizzler/FizzlerEx.