32

Retrieve the current FireFox URL with python

 3 years ago
source link: https://www.codesd.com/item/retrieve-the-current-firefox-url-with-python.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Retrieve the current FireFox URL with python

advertisements

I want to know what is the current url of active tab in running firefox instance from python module. Does FireFox have any API for this and does python know to work with it?


The most convenient way maybe insatll a firefox extension to open up a tcp service, then you can exchange info with firefox.

mozrepl can set up a telnet service, you can call js-like command to get info.

With telnetscript (http: //code.activestate.com/recipes/152043/), you can write:


import telnetscript

script = """rve
w content.location.href;
ru repl>
w repl.quit()
cl
"""

conn = telnetscript.telnetscript( '127.0.0.1', {}, 4242 )
ret = conn.RunScript( script.split( '\n' )).split( '\n' )
print ret[-2][6:]

Related Articles

Get the URL of the current Firefox session with Swift or Objective C

Is it possible to retrieve the URL from an active firefox session with Swift or Objective-C. So far i was able to retrieve the Name of the actual tab with applescript but not the URL. What would be the right way?Not without installing something like

MacOSX or AppleScript: get the current Firefox URL

How can I get the current URL from Firefox (3 or 4)? All solutions I have found so far either don't work (e.g. those with "class curl") or are ugly hacks which are no solution for me (sending key presses to copy the URL to clipboard).Well, I hav

How do I view the current browser URL with ASPX NET c #?

how to see the current URL from browser? Is the user coming to my page directly via www.mypage.com/myapp or through apps.facebook.com/myappIs this javascript? You can use: alert(location.href); Or: alert(document.referrer); The first one shows the cu

Redirect to the current usable URL (with url or not)

I have a scenario where the website user have a filter-bar, to set what content they want to see on the website. After selecting the options the user clicks on the .net submit linkbutton. The problem is that I want to reload that current page, but I

How to save the current web page with casperjs / phantomjs?

Is there a way to save the current webpage by using casperjs or phantomjs? I tried to get the html and save it into a file. But the resulting file was a lot different from the screenshot of that time (with casper.capture). Is there a way to save the

Obtain a schema of the current request URL

In Ruby/Rack, I'm able to get the scheme of the current request URL from scheme#request. However, in Go, http.Request.URL.Scheme returns an empty string: package main import ( "fmt" "log" "net/http" ) func main() { http.Handl

Retrieving the current date and time from a time server

In my Android app, I would like to retrieve the current date/time (UTC) from some server. Android does have the built-in ability to synchronize the device's date and time with some server but I have found this to be unreliable. Does Google or some ot

How to pass the current Gmail URL from Gmail

I am sending a mail to Gmail account. The body contains 2 Buttons. Approve and Reject. I am able to submit the form with Approve and reject parameters through the form action url. But I need to pass the current email URL also. But the javascript is n

What is the advantage of URLs with semantically dead components?

I noticed today that SO uses magic URLs in the form. For example, a question is ".../questions/[nnn]/[description]. As an experiment when showing a question I changed the description and hit enter. As expected, it did not affect the request and the q

Get the current TTY path in Python

How do you get the device path for the current TTY? Python has sys.stdin, sys.stdout and os.ttyname but you cannot pass either of the formers to the latter because it requires a file descriptor.You can pass sys.stdout.fileno to os.ttyname: In [3]: os

Retrieve the current user connection in Sharepoint from a Silverlight application

Is it possible to retrieve the current user login used on sharepoint from an embedded Silverlight 4 application?On SharePoint 2010 Use client object model (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.web.currentuser.aspx). Som

How do I retrieve the current presenter in GWT or GWTP?

Here is my problem. I have many links in my header presenter. Link1 - Link2 - Link3 - GuideDialogLink When user clicks on Link1 or Link2 or Link3, it will open a new browser. However, when user clicks on GuideDialogLink, then it will popup a DialogBo

Ability to retrieve the actual raw URL for the Rails query?

I want to retrieve the actual, encoded URL value for a page I visit in my Rails application. So, if I visit http://domain.com/dir/test%2Bpath, I should get the value "http://domain.com/dir/test%2Bpath" and NOT "http://domain.com/dir/test+pa

How do I get the current Firefox profile path from my applet?

I'm using Network Security Services for Java (JSS) by Mozilla in my applet in order to allow some low-level interaction between my (signed) Java Applet and Mozilla Firefox. One of the first problem I'm facing is how to find the current Firefox profil

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK