How do I get the URL of the active tab in Firefox/IE/Chrome?

Tim Harig usernet at ilthio.net
Mon Nov 29 02:28:24 EST 2010


On 2010-11-29, Michel Claveau - MVP <enleverLesX_XXmcX at XmclavXeauX.com.invalid> wrote:
> Hello!
>
>> The "InternetExplorer.Application" automation object doesn't contain 
>> any way to manipulate tabs directly
>
> False. Try this example:
>   import win32com.client
>   for instance in win32com.client.Dispatch('{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'):
>       print instance,"  URL :",instance.LocationURL

A Shell collection object != a InternetExplorer.Application object.
The problem with using a ShellWindows object is that you could easily
connect to the wrong instance, especially since the OP doesn't know the
LocationURL of the instance that he is looking for.  That is why I asked
for clarification.  Once we know what the OP is trying to do, we can
make sure that he has a reliable method to connect to the proper instance.



More information about the Python-list mailing list