I would like to script Firefox to do the following:
Open my website in multiple tabs
Perform some action on the loaded site (e.g. click on a button)
Preferably running some script (e.g. Python) and somehow connect to my local Firefox and send some commands over.
I know that I can do (2) on the web console with, e.g. $x('/xpath/to/my/button')[0].click(), so I thought of using Firefox's remote debugging mechanism, but
I'm not sure how to "talk" to Firefox using a script through the debugging port (i.e. what syntax)
Somehow I can't even get the remote debugging port to open.
I've tried the following solutions:
Start Firefox with firefox --start-debugger-server 9000
Enter listen 9000 on the web console
Enable Enable browser chrome and add-on debugging toolboxes and Enable remote debugging
All of the above at the same time
But still couldn't get remote debugging to work (didn't open the expected listening port).
Any idea how I could do the above (with remote debugging or something else)?
Related
Anyone know a way to set up Google Chrome so we can open development servers on? Instead of setting it as the general default browser?
In other words, I don't want my development servers to open up on Safari (that's what I have at the moment) each time I run my local development server, but I don't know how not to do that unless I switch Chrome to be my default browser (which I don't want it to be my default). Is there a way I can write in my .bash_profile to do this (automate the process of only opening Chrome for development purposes)?
I'm using xpages and lotus notes.
I've followed the guides mentioned from various sites about setting up debugging with lotus notes xpages javascript,
where
JavaEnableDebug=1
JavascriptEnableDebug=1
JavaDebugOptions=transport=dt_socket,server=y,suspend=n,address=8000
has to be set up on workstation and on dev server.
Also, the port 8000 has to be enabled, and opened in default firewall on workstation and dev server.
And create a Javascript debug config on LN with ip address of dev server, and port 8000.
Also checking, port 8000 is not being used as per using netstat...
on workstation and on dev server,
and so I did...
Then soft restart workstation and dev server, loaded up LNotes and designer,
then using Chrome, I loaded my app for debugging,
then going back to LNotes while app is running and focused on the browser,
then trying to run my Debug config...
But debugger still does not connect, and keeps popping the help info screen.
So, what could I have missed?
In Domino Designer you need to switch to the Debug tab and click on the bug to start your session.
I found it doesn't connect always directly. When you see only 2 threads it didn't. Click disconnect and connect again.
Once you see more threads you are good to go. You also need to set some breakpoints otherwise it runs through
I have this code in my WinJS default.html:
<x-ms-webview src="http://localhost/"></x-ms-webview>
<x-ms-webview src="http://display/"></x-ms-webview>
<x-ms-webview src="http://192.168.1.2/"></x-ms-webview>
display is defined in the hosts file:
127.0.0.1 display
and 192.168.1.2 -- the one that is successful -- is another computer on the network.
This is in my appx.manifest:
display and localhost successfully load in IE on the desktop and metro.
My OS is Windows 8.1 Enterprise. I have also completely disabled the Windows Firewall and this has had no effect.
What else can I do?
Microsoft blocks connections to the local machine except while running from the Visual Studio debugger.[1]
There is, however, a workaround tool. Quoting from this post on an MSDN blog:
Immersive applications (and IE11 on the Desktop) run inside isolated processes known as “AppContainers.” By default, AppContainers are forbidden from sending network traffic to the local computer (loopback).
[...]
I have built a GUI tool that allows you to very easily reconfigure an AppContainer to enable loopback traffic. This tool requires Windows 8 and runs on the .NET Framework v4. When launched, the utility scans your computer’s AppContainers and displays them in a list view. Each entry has a checkbox to the left of it, indicating whether the AppContainer may send loopback traffic. You can toggle these checkboxes individually, or use the buttons at the top to set all of the checkboxes at once. Click Save Changes to commit the configuration changes you’ve made, or click Refresh to reload the current configuration settings.
The aforementioned standalone tool is available from here.
Chrome can be run to support remote debugging by starting it via the command line with a prompt such as chrome.exe --remote-debugging-port=9222 --user-data-dir=C:/foo. This is often used to debug on android or iOs using a Browser on a Desktop Device but I would like to debug chrome running on a desktop PC. from a "client browser" on the same machine one can call localhost:9222 and see the server browser, calling localhost:9222/json will result in a json representation of the tabs open in the "server browser". This works just fine.
However, when I try to use another device in the same (wifi) network by calling [local IP]:9222 or [local IP]:9222/json (local IP is the IP of the server browser) I get a connection timeout. Is it possible to use remote debugging in such way? Are any other switches needed when starting the browser?
Edit I have found some use of forward tcp for the debugging of mobile devices, but there does not seem to be such a switch for chrome.
Edit 2 This seems to be a bit of a duplicate of the questions here and here however, as of yet I have not gotten the solutions presented there to work.
So, apparently this comes down to forwarding a port to localhost:9222. However, at least on windows machines I have no luck with SSH tunnels. Are there any other ways to forward on the machine?
As you've mentioned it, the solution is to forward the port 9222. Below you find approaches for Linux and Windows.
Linux
After having started chrome with
chrome --remote-debugging-port=9222
Forward the port
ssh -L 0.0.0.0:9223:localhost:9222 localhost -N
This way you can access the debuggin interface from an external device on port 9223 using a Chrome browser.
Windows
As seen in this answer, on windows (tested on 7,8) the easiest way to do portforwarding without 3rd party apps is via netsh
I've created a batch file with the following content. It has to be ran as administrator, and with no previous chrome windows open:
netsh interface portproxy delete v4tov4 listenport=9222 listenaddress=0.0.0.0
start /b cmd /c call "\program files\google\chrome\application\chrome.exe" -remote-debugging-port=9222
timeout 5
netsh interface portproxy add v4tov4 listenport=9222 connectaddress=127.0.0.1 connectport=9222 listenaddress=0.0.0.0
This way you can access the debuggin interface from an external device on port 9222.
Make also sure that no firewall is blocking the corresponding port.
You can achieve the same behaviour by adding the argument
--remote-debugging-address=[YOUR_EXTERNAL_IP_ADDRESS] as reported here, without any additional software other than Chrome itself.
I've successfully used RInetD for easy port-forwarding in Windows 7, tried this and it worked like a charm, externally debugging a Chrome browser in Windows from a Chrome in Mac/Ubuntu.
You can download rinetd from:
http://www.boutell.com/rinetd/
Unzip the file, create an empty file with any name (I used rinetd.conf), with this content:
0.0.0.0 9223 127.0.0.1 9222
The in Windows console run it with:
rinetd.exe -c rinetd.conf
And voila!
I love firebug for helping debug my web apps, as well as seeing how others have implemented there sites. However firebug hinders memory leak testing.
I've just found that FireFox can be launched in safemode which disables all addons, which is great for memory usage testing however once firefix is launched (either samemode or not) all subsequent firefox launches (they all appear in task manager as 1 firefox instance) will use the mode of the first one.
I'd like to leave one in same mode testing some apps for leaks and use another with firebug to develop.
I've tried making a copy of the FireFix.exe and even copying the whole firefox directory but it still launches as one application.
I could always use VirtualBox to create a full virtual PC for this testing but that seams like a large overhead.
Edit
I have just tried the -no-remote switch but it just comes up with "firefox is already running .... you must first close the existing Firefox process.... "
First close all your Firefox instances. With all instances closed, run firefox via the "Run..." dialog on windows, typing "firefox -p". It will open with the profile manager, where you can create multiple profiles with different configurations.
After creating your profiles, just run you "main" browser using "firefox -p" and select your "main" profile. To open another instance using a different profile, run Firefox using "firefox -no-remote -p" and it will prompt the profile manager again, so you can choose a different profile.