Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIs it possible to ExecuteJavaScript or emulate user actions like key pressing on loaded page? #183
Comments
|
Are you using an SPA framework or not? |
|
I used to use NightmareJs + MeteorJs, but I'm looking for c# solution. Something faster than Selenium+Chrome. |
|
@ziomyslaw you can use https://electronjs.org/spectron For .NET Support write a Spectron.NET solution for Electron.NET :) |
|
I think what he means is similar to this question: https://stackoverflow.com/questions/28920621/how-to-call-a-javascript-function-on-a-web-page-rendered-by-electron What is the equivalent to the following solution in Electron.NET?
|
|
Is there any solution to this? Being able to execute javascript and to convert the resulting javascript object into a C# object would be very useful. |
|
@LittleEndu yes, that works with the ElectronHost Hook feature. Take a look at the example of the WebApp here. There is a sample code deposited. In the example application you can also get a step by step guide. |
|
I managed to inject the "electron-chromedriver" npm package into the build command of ElectronNET. It was simply by adding another line after npm install at line 123 in BuildCommand.cs:
Of course, this could also be achieved by editing the packages.json file. Using this modified build command, I built the whole ElectronNet project. Then created a small .NET test project with ChromeDriver that uses the "BinaryLocation" property at driver creation. With this setup, I can control and test the ElectronNET application. |
|
I am trying to execute some JS code as well, but so far I have not found any solution. I am in need of the |
|
i used LoadURL to exec javascript .
|
I am looking for solution to replace NightmareJs with c# implementation.
The NightmareJs wraps electron api to allows not only to type or click but execute js as well i.e.
win.webContents.executeJavaScript(src)
WebContentsdoes not provide such methods.Is there any equivalent way to do this?