I have build a c# Windows Form application which required both automation and human interaction on the Chrome browser opened by selenium.
Currently 3 separate windows open
1. My Winform application
2. Selenium Console
3. The Chrome browser
I would like to embed both the console (will embed but hide from view) and the browser opened in the application itself. I have found this answer explaining how to embed the console application.
The link you've provided gives you some example code to work off.
That allows you to embed the console in to your WinForms window.
I then found this link, which goes a bit more in-depth in to the matter.
Granted, the link is rather old but it should get you started in the right direction.
Regarding the links provided by the page I linked, Selenium provides NuGet packages for C#:
install-package selenium.webdriver
install-package selenium.webdriverbackendselenium
install-package selenium.support
That should at least provide you with a decent start.
Related
As Blazor can run on client side via WebAssembly, can we develop/design Google Chrome extensions using Blazor?
I have developed a package to be able to build a Blazor WebAssembly application into a chrome extension.
Checkout the repo on GitHub for a step by step instruction how to convert your project to a Blazor chrome extension project.
Check out this Github repo that demonstrates a Hello World Chrome Extension written in Blazor. It has no interaction with Chrome APIs but does show how to package up a Blazor app as an extension.
https://github.com/traxium/webassembly-chrome-extension
You should be able to use Javascript Interop to call browser APIs, but I don't know of any way to call them directly. An open source project that mapped the browser APIs to C# would be ideal here.
Yup! We can develop/design Google Chrome extensions using Blazor-webassembly-app.
I'm building a chrome extension using asp.net 5.0 in blazor-webassembly-app.
I have faced so many difficulty till now and right now I am continuously facing difficulty its because no one in the world tried it yet and I am researching on it while building my POC (proof of concept).
I am working on my college project to build a Web Browser. I am Halfway through My Project and i came to know that WebBrowsers need javascript interpreters to Display latest websites.I am using c# language in Visual studio 2012. It Still Displays Some of the Basic Webpages but Doesn't Displays latest updated webpages like Google maps. I tried to suppress the error but doesn't help in other high end web pages. So how can i build a javascript interpreter and install it in my web browser.
Code I used to suppress the error
c# getCurrentBrowser().ScriptErrorsSuppressed = true;
The reason is that, you code is using the IE browser of your windows. IE often have incompatibilities. Try doing some research and inject a proper browser like chromium or gecko.
Look at this package
We have a set of Selenium tests in c# project with xunit.
We use headless chrome and tests are running just fine on PCs with Chrome installed.
However, on build agents we don't have Chrome, so we receive an exception cannot find Chrome binary.
Is there any way to ship Chrome within test project as a standalone exe, so we don't have to install it on the servers?
Any other suggestions?
There is an option to achieve what you are after, via portable Chromium bundle
within test project as a standalone exe
Basic steps are:
download desired version from their page
unzip
run chrome.exe
Main advantages of the portable browser are that you can carry it with your projects anywhere, avoiding installation and dabbling with the windows registry.
It is true that Chromium is the open-source version of Chrome itself, but is efficient enough just like Chrome. Keep in mind that there are some functionality differences, when it comes to flash and PDF.
I am trying to use cefsharp so i downloaded the repository from their website and tried to copy and paste every thing as it is from the windows forms application to my application in order to use the ChromiumWebBrowser.cs that comes with it... however when i run my application it only display a white area (sometimes just invisible hole) with no error or anything... have been trying for over 30 hours with no luck although it is running normally at the example project.
You dont need to copy any thing, just install Cefsharp from Nugetmanager of Visual studio.
GetStartfromhere
See this related issue for suggestions: CefSharp WinForms Web Browser Won't Display
If that doesn't help a few particular items you should check:
Work your way from the CefSharp.MinimalExample repo which now contains a WinForms example
Start your project by using the NuGet package (as mentioned in the SO answer above). It takes care of copying all needed Chromium resources
Make sure your NuGet version is at least 2.7
Setup your project configuration as either x86 or x64 ... with AnyCPU the NuGet magic won't work currently
What are the steps to deploying a project created in VS2008 (windows forms and c#) as a ActiveX control hosted in ie? I have a file uploader project that I want to be hosted on a webpage that users can navigate to, click 'trust this active x control' and the application runs on the page in the browser, just like a java application.
To be clear, I'm not looking for ClickOnce (that is an installer) and I don't want the user to have to modify their .Net security or add a trusted site (so just putting the .dll file in a OBJECT tag doesn't work). Do I need some digital signature, some certificate something? I've found references to this but no step-by-step guide to it (like I got for java).
Any suggestions? This seemed like it'd be the easiest part of the project but its turning out to be by far the hardest, I can't make any headway on it.
Thanks,
Sam
And the answer is, sadly, that .net "activeX controls" aren't like COM activeX controls (VB6), even if you make the .net control com-visible you can't register it with the OS the same way. What you have to do is:
1) Create your .net dll file
2) Create an installer exe (I did it with InstallShield, looks like it can also be done in VS)
3) Package that installer into a cab file
4) Point to that cab file in IE.
What this results in is in IE the little 'activeX' confirm drops down, then the 'do you trust this app' comes up, then UAC (vista/w7) and then you get to run through the normal application install process: installer window comes up, confirm, pick install dir. After thats done, your control appears on the page in IE.
The way it used to work in COM was once you did the little activeX confirm drop down (and UAC) the app would just run
Now, the above is only if you need/want it to be .Net 2.0 compatible. If you don't mind only being compatible with 3.0 or higher you can do an XBAP application:
What is Microsoft's roadmap for in browser applications? Silverlight, ClickOnce, ActiveX, dlls
And you can even just take your .Net dll you spent the last 3 weeks learning how to make (frick) and jam it into the WPF application:
How to put a custom windows forms control in a WPF application?
Hope this helps others.
Sam
We deploy AX control in two forms:
CAB file. Installation process as you described in question. You need sign control, pack it into CAB and sign the CAB file. More details you can find here: Packaging ActiveX Controls.
Standalone installer. MSI file for users without admin privileges for manual installation.