I'm writing a debugger tool using Electron (I'm creating my own UI, so I don't use the built-in DevTools).
I'm using win.webContents.debugger to access the debugger instance and I can control my renderer.
The problem is when the renderer creates a web worker:
new Worker('script.js');
I don't receive any debugger related events to it nor can I access it (I can access it when I use DevTools, but I not using the debugger instance).
How can I access and control my web worker with the debugger instance?
EDIT: I've setup a demo project to demonstrate the problem: https://github.com/giladno/electron-quick-start
Related
We use some third party enterprise software ("Container App"), which has an embedded Chromium browser, in which our webapp runs.
We use Cypress to test our webapp in a stand-alone browser outside of this container, however we would like to be able to test it inside, as it interacts with the container in various ways through javascript.
The only thing the container exposes is a "remote devtools-url" to the target (our) browser, which can be pasted to a native browser outside of the container and then debugged in devtools. Like this:
The Container provides 2 different url's for above debugging purposes, and they both work and seemingly similarly. They are something like the following (not precise, unfortunately I am not at work atm):
devtools://...inspector.html?id=xxx
http://ip/...inspector.html?id=xxx
Is it possible to setup Cypress to test "as normal", only having access to this remote devtools-url/port?
The target browser inside the container cannot be started by Cypress, as only the container can start and close it. So the target browser will already be running (with a --remote-debugging-port). I can get the devtools-id dynamically through a call to /json/list.
If not possible, any other way to achieve the goal of testing the browser/app running inside the container?
It is not possible. Testing with Cypress a web page in embedded Chromium running in your application means Cypress needs to connect to already running browser. Cypress doesn't have that possibility.
The documentation states:
When you run tests in Cypress, we launch a browser for you. This enables us to:
Create a clean, pristine testing environment.
Access the privileged browser APIs for automation.
There is a request in Cypress issue tracker to add the option to connect to already running browser. But there is no response on it from Cypress developers.
I'm new to electron and I want to make sure I understand the distinction between code that is appropriate for the main process vs the renderer process. The app is essentially a React app hosted inside a single electron page. So, as I understand it, I have one main process and one render process.
If I want to make REST calls as part of the React app (using axios for example), I assume I can do it inside the React code within the renderer process, right? No need to go to the main process for that is there?
I also have to create a socket connection to an outside server. This is not an HTTP REST interface, it's a raw TCP/IP socket. Can this also be done within the renderer process or do I need to go to the main for that?
I tried putting the socket calls using node's net library and it seems to work okay. The very first time I got some kind of connection error but subsequent tries seem to be working. That one error is making me wonder if using net inside the renderer is a good idea though.
I have been fooling around with Node.js and Azure. I have created a simple worker role which supports socket connections. I'm trying to debug my application but don't really know how, since it is essentially a socket server. To make matters worse I haven't figured out a way to write to console or log data within this worker role. I'm hoping that someone has figure out a good way to go about debugging Node.js in Azure. Thanks for the help in advanced.
if you're running in the emulator, you can see your logs in the Emulator GUI (right click on the emulator icon). If you're running in Azure, your best bet is to log to a blob storage. You can also enable remote desktop to access Windows Azure VM remotely.
When i was initially developing under Nodejs as a socket server too, i was directly running and debugging node.exe from WebStorm so it was acceptable to just console.log() or util.inspect() and see activity happen on WebStorm's console window.
Of course when we deploy to Windows Azure that was not going to help as there appeared to be no way to see the runtime console window of the launched node.exe process in the server even if we remote desktop in. After trying out a couple of logging libraries, the only one that actually could save to a file was log4js.
I have a logger object which is exposed to the rest of the application, so they do not have to know about the actual implementation library.
var log4js = require('log4js');
// The logger helper utilises log4js under the covers.
// Serves as a wrapper from the rest of the application.
log4js.replaceConsole();
log4js.configure({
appenders: [
{ type: 'console' },
{ type: 'file', filename: 'log/socket.log', category: 'socket' }
]
});
var logger = log4js.getLogger('socket');
So the information will be logged to the E: or F:\approot\log\socket.log file in the deployed server.
Then use a tailing program like baretail to observe the real-time activity as they get logged.
I have created a WCF Data Service and using it in a web application which is the part of same solution.
The WCF service holds the reference of another DLL(Utility.dll) which is also part of the same solution.
I have added the service reference of the WCF service in the web application.
So the structure is
Solution
|
|- Utility Dll
|
|- WCF Data Service (has reference of Utility.dll
|
|- Web Application (have service reference of WCF Data service)
But something is going wrong in the Utility.dll and I want to debug it.
Can any one please let me know how to debug it using VS2010.
You can also use a unit tests project to get the benefits of unit testing and possibility to launch the tests with the debugger.
Set a breakpoint at the web method invokation in the client and run your application when the debugger stops at the breakpoint hit F11 to step into the web method code execution which will automatically attach to the service process.
I'm assuming you don't have the project that created Utility.dll.
If you have the debug symbols (.pdb) for the Utility.dll you can load the symbols and step into the code. Set a breakpoint before the call to the code in Utility.dll and run your project. When you hit that breakpoint, go to your Call Stack window (CTRL+ALT+C) and right click a frame that starts with Utility.dll, and choose "Load Symbols". You should get prompted for the .pdb location.
Yes, you may set "WCF Data Service" as default project, then point svc file in Solution Explorer and hit Debug button (F5 normall). This will bring "WcfTestClient.exe" and connect to your new service and you will be able to debug your interface without any problems.
Put both of your project in same solutions(WCF service and WCF Service TEst Client).
Add the "Project Reference" of the service in to your Test Client, using Add reference.
Set the default project to your test client.
set the break point in your service's contract Or any where you want.
Make sure you are calling the method from you client which is being set in you service's break point.
Make sure "Debug=true" is on for both projects.
Regards,
Mazhar Karimi
I'm trying to setup CI environment for QA department. They use SeleniumRC to run UI tests in IE and FF browsers to test some web application. I had a success configuring it to run as a windows service as described here. However when i run the test it hangs. I can see iexplore.exe process spawned by Selenium service in the process list but nothing more happens. No browser window appears, no entries in the windows event log. I did a lot of googling and as fas as i understand the problem is interaction with desktop. I tried to run the service under SYSTEM account with "Allow service to interact with desktop" check-box set as well as under a regular user account with local admin permissions. So my question is if it's possible at all?
In our organization we have a continuous integration server (Cruise Control) running the build including Selenium RC tests. The CI server is run as a Windows service (on MS Windows 2003 Server) and Selenium tests are just part of the test suite.
That is quite a straightforward setup and frankly I see no reasons for giving up with it. Currently in our setup the Selenium server (and client) is started directly from the tests (however we used to have Selenium as a separate service).
In Java code (actually in the super class of all web tests) we do something like:
// to start the server
RemoteControlConfiguration config = new RemoteControlConfiguration();
config.set(...) // set the serverHost and port
...
SeleniumServer server = new SeleniumServer(config);
server.start();
// and then to start the client
Selenium selenium = new DefaultSelenium(serverHost, port, "*firefox", "http://www.google.com");
selenium.start();
selenium.open("http://www.google.com");
// now the browser should be visible for you (if you run it locally, not as a service)
So I would suggest you trying the following (whatever language you are using):
Try to run the Selenium server and client from just a standalone application. The browser should show up as a window. Adjust the settings to your needs (browser type, etc.).
Try to incorporate the code within your test framework (xUnit or whatever). Run them manually. The result should be the same.
Then you can try to have the tests run from the continuous-integration. Run the CI server as a service and let it build your project. The browser wouldn't be visible, but that's not required for the tests to be run, isn't it?
NOTE:
if you wanted to peep what Selenium is doing, I believe it would be easier on UNIX machine. You could point the tests to use the X-server DISPLAY of your choice - a fake one or a true one connected to some monitor.
I'm skeptical about running anything as a windows service that is supposed to interact with a desktop application. Windows services run in their own sandbox; they're not supposed to interact with a user's desktop or its applications. To do so requires special efforts to communicate with the service, so if it is possible at all, I would think there would be some kind of desktop client running as well, acting as a liaison between the browser and the windows service.
I can't tell you it won't work, though, because it is obviously possible if people are blogging about it.
Why does it need to run as a Windows service, by the way? Is that how Selenium has set up their automation, or can you do it without the Windows service? Because I think that would be the shortest distance between two points.
My recommendation would be to have a dedicated machine (or virtual machine) for running Selenium RC. In my experience it's best to let Selenium run interactively rather than in a headless mode.