I am new to using CEF Sharp. So I went to the github.io page which pointed me to this setup tutorial
Having setup my project using Nuget, which installed CEF 47. I ran the project (which simply opened Chromium browser in a WinForm with http://www.google.com). The browser opened up fine but then I could not interact with the page. I could not select the text box or click on the html buttons. When I tried to resize the browser, the app froze and I had to stop the debugger to get out of it.
Am I missing something?
Here is the code,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;
namespace CEFRetest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitBrowser();
}
public ChromiumWebBrowser browser;
public void InitBrowser()
{
Cef.Initialize(new CefSettings());
browser = new ChromiumWebBrowser("www.google.com");
this.Controls.Add(browser);
browser.Dock = DockStyle.Fill;
}
}
}
Another thing that I noticed, is that the dlls (libcef.dll, icudtl.dat, CefSharp.BrowserSubProcess.exe, CefSharp.BrowserSubProcess.Core.dll) are not in my bin/Debug directory when I install CefSharp.WinForm using Nuget Package Manager. I only references that are added from Nuget are CefSharp, CefSharp.Core and CefSharp.WinForms.
Could that be a problem?
UPDATE
Ok so it seems I have the required dlls and files but they are in bin\x64\Debug.
Related
I was trying out the Metro UI to create a C# application so I was testing out the framework tools in a new project. I've followed the instructions from https://n-a-r-w-i-n.github.io/MetroSet-UI/#how-to-use, as well as watching youtube videos where they install it via the Package Manager Console. All result in the same error I have been getting when I try to add an item to the form. Encountered Error
After running the design view goes completely blank and I cannot edit or do anything in that regard. Here is the code used for Form1.
using MetroFramework.Forms;
using MetroFramework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Test_App
{
public partial class Form1 : MetroForm
{
public Form1()
{
InitializeComponent();
}
}
}
I have notices I also have this warning.
Severity: Warning
Code: NU1701
Description: Package 'MetroModernUI 1.4.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
Project: Test App.csproj
Line: 1
Please assist me to get a hang of this! Thank you for your time in advanced! :)
This question already has an answer here:
Visual studio does not open the graphical editor for Winforms anymore
(1 answer)
Closed 3 years ago.
I installed Visual Studio 2019 Community completly new today and wanted to make a simple form. To do so I created a new "Windows Forms App (.NET Core)" in C#.
The problem is that I cant open the Designer. If I try to it always takes me to the code editor which just shows me the code editor with the following code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Tic
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
I have already tried uninstalling installing and making a few new projects. Always the same problem. I didnt alter any code.
Most recent update on the same was listed in the designer release note. Try installing the windowsformdesigner setup, and can be found here
When I run this code:
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using Sikuli4Net.sikuli_REST;
using Sikuli4Net.sikuli_UTIL;
using SikuliModule;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Sikuli
{
class Program
{
static void Main(string[] args)
{
driver = new ChromeDriver();
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("https://www.google.co.nz/");
Thread.Sleep(2000);
String image = #"C:\Users\safa\Desktop\gmail.jpg";
SikuliAction.Click(image);
}
}
}
I got this exception:
System.ComponentModel.Win32Exception:
'The system cannot find the file specified'
I changed file location but again I got same error.
This the image that I want to click on:
Run the visual studio as administrator using below steps
Click on start(windows) button
Type Visual Studio
Mouse Right Click on Visual Studio
Click on Run as Administrator option
I think there is no mistakes in code. So try this once.
Increase the wait time to 5000ms
For this program you don't need Sikuli4Net, remove usings related to that
I'm working on Matlab and C# projects, I've created a DLL file from the Matlab project and run it on the C# project.
My code works fine on my computer and on any Windows 7 x64 bit that I've tested.
The problem is with Windows 8, When I'm trying to run my app on Win 8 PC the app collapsed while calling to the main class that included in the DLL.
I tried to catch the error, but no error occurred, the app just crashed.
I've already installed MCR for the specific Matlab version, but it still doesn't work.
I believe that I'm missing some system configuration, can someone help to do some order what exactly should I do in order to run it?
UPDATE1:
The code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using VisionCameraQA;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
namespace VisionCameraQATest
{
public partial class Form1 : Form
{
cls_Main main;
public Form1()
{
InitializeComponent();
try
{
main = new cls_Main();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString())
}
}
}
}
The app crashes while getting to main = new cls_Main();, it is not reached to the catch at all.
I want to use Appium to make automated testing for my Android app. I downloaded the Appium for Windows and could run my app on device from within appium.exe. Now I want to write test cases in C# which make use of selendroid integrated in Appium. I googled a lot but couldn't find any example demonstrating the same. I found one project on github but it's giving a lot of compiler errors. Could anybody guide me about how to write test cases using Appium in C#? If you have any resources, please provide me the same. Thanks.
You can go with installing Visual Studio 2012 or visual express for web. Use NUnit framework to write the test cases and execute them as a class library project in that.
1) Create a class library project and create a new class e.g "Class1". Add the packages as provided in the links above. Try the below code
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using NUnit.Framework;
using OpenQA.Selenium.Interactions;
using System.Threading;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.MultiTouch;
using OpenQA.Selenium.Appium.Interfaces;
using System.Drawing;
namespace ClassLibrary2
{
[TestFixture]
public class Class1
{
public AppiumDriver driver;
public DesiredCapabilities capabilities;
public Class1()
{
Console.WriteLine("Connecting to Appium server");
capabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.BrowserName, "Android");
capabilities.SetCapability(CapabilityType.Platform, "Windows");
capabilities.SetCapability(CapabilityType.Version ,"4.1.2");
capabilities.SetCapability("Device", "Android");
//Application path and configurations
driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
}
[Test]
public void login()
{
driver.FindElement(By.Name("Country")).Click();
//Your further code as per the application.
}
Then Build a solution for your project and run it in NUnit.