Browser automation in .Net - silverlight

Can I automate actions like filling and submitting a form, clicking links et.c. in a real browser (i.e. IE11 or Firefox) using only a Silverlight or an XBAP application?
I would be grateful if you could let me know any other solution (other than the two above) that can do the automations without the need to manually install third party software (like Selenium or Telerik Testing Framework).

No one answered, so I'll tell you what worked and what not.
Silverlight solutions didn't work due to the Same-origin browser policy.
The XBAP solution actually worked. I created a new XBAP application and loaded it in my other application inside an iframe.
The user must accept the pop-up and the XBAP application opens a new WebBrowser control doing its stuff.
The whole thing only supports IE.

Related

Winappdriver and selenium in the same automated test

Hi I could do with some help / more experienced eyes.
I have a WPF application which I have started automating some UI tests for using winappdriver, upon further investigation it has embeded html in it - webview, and can fire off requests to open the default browser with app related content - such as help files.
Has anyone had experience in working with this? For example:
open the WPF app,
click on help button on the WPF app which will open a browser and
then continue the test to ensure that the correct help page has been launched with the correct content in relation to the WPF page it was fired from.
Presumably this can be done in my case with chrome driver (winappdriver cannot see the content on the webpage). I have tried using selenium's window handles, but it's like the driver can't see the already open browser page. So I am at a bit of a loss and really not sure what to do.
In previous roles I was used to using Ranorex, which does both windows and web based UI automation. So I have never had any experience using multiple driver types to do the one test.

reCAPTCHA v2 with wpf webbrowser / frame control

reCAPTCHA has limitation on browser supports however it works on IE without adding any value in compatibility mode. I have been trying multiple things with WPF application which is displaying a webpage hosted inside a Frame (or Web Browser) control. That webpage has Google reCAPTCHA V2 (I'm not a robot). It works fine in all the browsers but inside WPF app it fails to display properly.
Based on following link we need to have specific browser support
https://support.google.com/recaptcha#6262736
I also made sure javascripts are enabled and working fine. Any suggestion?
I ran into this issue as well and the only thing I know how to make it work is go into the recaptcha admin console and slide the security preference to the easiest so the webBrowser control can do the image verification at the very least
Update:
Found out basically because the web browser control is IE 7 by default
Use latest version of Internet Explorer in the webbrowser control

Silverlight 5 app from iframe not closing in IE9

I am developing a web application using Dojo v1.8 and my target machine runs IE9 and Silverlight 5.1.20125. In this web app, the user can select a tool from a toolbar at the top of the page that will open up in a content pane (or an IFrame if it is an external tool) below the toolbar (only one tool can run at a time).
The bug I am encountering is that one of the external tools that opens in an IFrame runs a Silverlight app, and if the user tries to select another tool, the new tool won't open and the Silverlight application stays there. After checking the DOM Tree, all references to the Silverlight application have been wiped, and the new tool is there instead (which is the desired behavior).
So my question is, why is the Silverlight Application still being viewed even when it is gone from the DOM Tree, and is there a way to programmatically close it from Javascript? Also, I do NOT have access to the source code of the Silverlight Application.
Well I did not manage to solve this issue directly. However, there was another bug that I ran into which involved the java swing library not working on the production machine. The solution was to add the following tag as the first element of head:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8>
This forces IE to use IE8 instead of IE9. This trick solved this other issue, but inadvertently solved this issue as well. Here are several links that helped lead me to the solution (amongst others):
http://sourceforge.net/p/djproject/discussion/671154/thread/d7662f61
http://msdn.microsoft.com/en-us/ie/ff959805.aspx#_Compatibility_issues_with_1

Silverlight not loading inside WebBrowser control

There is a web page with a silverlight control, when we use browsers like IE, chrome etc, they are all working.
We develop a desktop program, embed a WebBrowser control to a win form, and navigate to the web page, the silverlight object is not initializing, only shows the silverlight logo, just like the silverlight has not yet installed, but actuall it has installed and working.
Is it the limitation for silverlight or there should be some kind of security settings in IE or the WebBrowser control?
I run silverlight in browsers as well as in a 'client' application (WPF, using a webbrowser type control). I can tell you in my project works without any issues, I've not had to change any settings apart from one - as I run it local host, IE prompts me about running in intranet mode.
You should use fiddler to see the exact URL that is being used in the navigation and to see if there are any errors returning from the web server.
I know it's not exact help, but I can confirm it should work. Hopefully that can help narrow your search a little.

What if we don't host our silverlight Application when we first Create it?

As we all know very well..
whenever we create application inside silverlight it is asking us for hosting it
by dialogue box at given below.
My question is what if i unchecked the check box[Host the silverlight application in a new web site].
Means what kind of problem we have to face later if I don't host our Silverlight Application in any of the option given by dialogue box.
Basically it is not a problem at all. You can add a website at any time later.
In the project settings of a website there is a Silverlight tab. Under that you will find the option to add Silverlight projects to the website. This will setup the links to generate the XAP in ClientBin as well as giving you the option to create test pages for each Silverlight app added. The test pages will give you the sample JS you need to host your Xap later.
You will have to eventually host your application somewhere otherwise it will stay on your local harddrive and hardly reach any clients. So if you have an existing web site you could simply copy-paste the necessary javascript to this site later in order to embed your Silverlight application. In this case you can uncheck this checkbox.

Resources