How to get active tab url from browser?

892 Views Asked by At

How do I get URL from current tab in browser using python? Using os.environ['REQUEST_URI'] gives an error. The following is my code :

os.environ['REQUEST_URI']

and the error :

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    os.environ["REQUEST_URI"]
  File "C:\Python27\lib\os.py", line 423, in __getitem__
    return self.data[key.upper()]
KeyError: 'REQUEST_URI'

Any other alternatives are also welcome.

1

There are 1 best solutions below

0
On

Alternate to your asked way by "os.environ", you can do it:

  • by copy and past by hand
  • on other ways than you asked way by python
  • by Brotab
  • by Selenium
  • by xdotool
  • by javascript from serversite or by code injection from client side