Re: [python-win32] Intenet explorer using PythonWin Help

2010-12-22 Thread Mike Driscoll

On 1:59 PM, Pat McGuire wrote:


I am new at programming with Python and am using Pythonwin.  I have a 
couple of questions'


1.  The code below after doc.FormName.submit() will navigate to 
the correct page but if I print the url it shows the url of the page I 
logged in at.  I thought submit would be just like if I clicked on the 
submit button.


import win32com.client
import win32api
ie = win32com.client.Dispatch( InternetExplorer.Application )
ie.Visible = 1
ie.Navigate(urlhere 
http://posting.www.backpage.com/classifieds/central/index)

while ie.Busy == True:
win32api.Sleep(1000)
doc = ie.Document
doc.FormName.email.value = emailaddress mailto:doublep...@gmail.com
doc.FormName.password.value = mypassword
doc.FormName.submit()

2.  Can you point me to a site that which show me how to access each 
type of form element, i.e. option, hrefs, links, etc



Any help is greatly appreciated.



I've heard good things about Mechanize: 
http://mechanize.rubyforge.org/mechanize/


It's not PyWin32, but it's probably easier to use than win32com methods.



--
Mike Driscoll

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Intenet explorer using PythonWin Help

2010-12-22 Thread Tim Roberts
Pat McGuire wrote:
 Hi Tim,
  
 Code is below with psuedo information

As I suggested in my first response, your first problem is that you are
not waiting for the submit to complete.  The IE control is asynchronous;
it returns immediately, before the request has actually finished.  You
need another wait loop after the submit:

while ie.Busy:
win32api.sleep(1000)

 if ie:
  print ie.LocationURL
  print ie.LocationName
  print ie
  print ie.Document.title
  print ie.Document.location
  print ie.Document.forms

Not sure what you expect the if ie: to do there.   I believe a COM
object will always return True in Python.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32