Access to objects in a frame on a web page

2013-09-12 Thread Ddp Ludo
Hello,

I am trying to program a robot which will allow me to test whether a default 
password has been changed on my intranet servers .

And I 'm stuck since 2 days ...

HTML structure of the page:

HTML
  HEAD
  frameset
frameset id=frmSet
  frame name=frameMain
html
   head
   body
 input id=username

I try to go to fill the username field and I turn around because of the frames.

I tried to do it with mechanize . But as we can see, there is no body in the 
web page, so I can not instantiate the object form and get the fields on the 
page via this method.

I can directly open the htm page where username and the enable button , but it 
does not work . It lacks all parent functions to actually start the 
identification.

Here is the beginning of my code works . It connects to my page and correctly 
returns me the source code.

br = mechanize.Browser ()
br.set_all_readonly ( False )
br.set_handle_robots ( False ) # ignore robots
br.set_handle_refresh ( False ) # can sometimes hang without this
br.addheaders = [( 'User - Agent ', ' Firefox' ) ]
url =  file :/ / / root/Prog/html/AC1.htm 
response = br.open (url)
response.read print ()

Then, searching the internet, it seemed to understand that the frames were 
referred by links () class

lnkList = []
br.links for lnk in ():
  lnkList.append ( lnk.url )
  print  links  , lnk.url

It correctly list my links.

But can not use follow_link ( ) find_link  I can not do it  impossible 
to reach my username field 

After the best , I can get the pointer of the frame object, but I use mechanize 
no more 

frame = sys._getframe (2)
print frame

Does anyone know a solution?

Either using code or in my thinking and my approach to the problem.
Excuse my poor english.

Thank you in advance .
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Read C++ enum in python

2009-08-19 Thread Ludo

Neil Hodgson a écrit :


   For some headers I tried it didn't work until the .* was changed to a
non-greedy .*? to avoid removing from the start of the first comment to
the end of the last comment.

file_data = ' '.join(re.split(r'\/\*.*?\*\/', file_data))


Thank you ! I adopt it !

Cheers.
--
http://mail.python.org/mailman/listinfo/python-list


Read C++ enum in python

2009-08-18 Thread Ludo

Hello,

I work in a very large project where we have C++ packages and pieces of 
python code.


I've been googleing for days but what I find seems really too 
complicated for what I want to do.


My business is, in python, to read enum definitions provided by the 
header file of an c++ package.
Of course I could open the .h file, read the enum and transcode it by 
hand into a .py file but the package is regularly updated and thus is 
the enum.


My question is then simple : do we have :
	- either a simple way in python to read the .h file, retrieve the c++ 
enum and provide an access to it in my python script
	- either a simple tool (in a long-term it would be automatically run 
when the c++ package is compiled) generating from the .h file a .py file 
containing the python definition of the enums ?


Thank you for any suggestion.
--
http://mail.python.org/mailman/listinfo/python-list