mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Is it possible to ExecuteJavaScript or emulate user actions like key pressing on loaded page? #235
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ziomyslaw on GitHub (Nov 14, 2018).
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?
@kwakuduahc1 commented on GitHub (Nov 18, 2018):
Are you using an SPA framework or not?
@ziomyslaw commented on GitHub (Nov 19, 2018):
I used to use NightmareJs + MeteorJs, but I'm looking for c# solution. Something faster than Selenium+Chrome.
@GregorBiswanger commented on GitHub (Jan 3, 2019):
@ziomyslaw you can use https://electronjs.org/spectron
For .NET Support write a Spectron.NET solution for Electron.NET :)
@niklr commented on GitHub (Feb 24, 2019):
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?
@LittleEndu commented on GitHub (Oct 26, 2019):
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.
@GregorBiswanger commented on GitHub (Nov 4, 2019):
@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.
@MrCircuit commented on GitHub (Jan 13, 2020):
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.
@vleeuwenmenno commented on GitHub (Aug 19, 2020):
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
executeJavaScript(string)function.@windhuan commented on GitHub (Aug 27, 2020):
i used LoadURL to exec javascript .